Add example of POSTing data to retrieve sensors (#25929)

* Add example of POSTing data to retrieve sensors

I found it hard to get a website that required POST data to work, so to save others the work of looking up how to specify the data (in this case) and setting the correct headers, I made this real-life example.

* Fix example to retrieve actual data

I've added a working postcode/house number combination, so that users can play around with live data.

* Removed duplicate resources

* Update source/_integrations/scrape.markdown

* Update source/_integrations/scrape.markdown

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
cvwillegen 2023-07-20 14:59:12 +02:00 committed by GitHub
parent 4e23e06aa3
commit 7be56f47a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,3 +259,28 @@ scrape:
``` ```
{% endraw %} {% endraw %}
### Container cleaning by CleanProfs in The Netherlands
This example gets the container type and container cleaning date for the next two cleanings.
```yaml
# Example configuration.yaml entry. Change postal code and house number to your own address.
scrape:
- resource: https://crm.cleanprofs.nl/search/planning
method: POST
payload: zipcode=5624JW&street_number=17
headers:
Content-Type: application/x-www-form-urlencoded
sensor:
- name: "Type container 1"
select: "div.nk-tb-item:nth-child(2) > div:nth-child(1) > span:nth-child(1)"
- name: "Date container 1"
select: "div.nk-tb-item:nth-child(2) > div:nth-child(3) > span:nth-child(1) > span:nth-child(1)"
- name: "Type container 2"
select: "div.nk-tb-item:nth-child(3) > div:nth-child(1) > span:nth-child(1)"
- name: "Date container 2"
select: "div.nk-tb-item:nth-child(3) > div:nth-child(3) > span:nth-child(1) > span:nth-child(1)"
```