mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-10 02:46:29 +00:00
Update rest.md (#1656)
This commit is contained in:
parent
b6731d9749
commit
a1956e5ee1
@ -568,6 +568,19 @@ curl -X POST -H "Authorization: Bearer ABCDEFGH" \
|
|||||||
http://localhost:8123/api/states/sensor.kitchen_temperature
|
http://localhost:8123/api/states/sensor.kitchen_temperature
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Sample `python` command using the [Requests](https://requests.readthedocs.io/en/master/) module:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
from requests import post
|
||||||
|
|
||||||
|
url = "http://localhost:8123/api/states/sensor.kitchen_temperature"
|
||||||
|
headers = {"Authorization": "Bearer ABCDEFGH", "content-type": "application/json"}
|
||||||
|
data = {"state": "25", "attributes": {"unit_of_measurement": "°C"}}
|
||||||
|
|
||||||
|
response = post(url, headers=headers, json=data)
|
||||||
|
print(response.text)
|
||||||
|
```
|
||||||
|
|
||||||
</ApiEndpoint>
|
</ApiEndpoint>
|
||||||
|
|
||||||
<ApiEndpoint path="/api/events/<event_type>" method="post">
|
<ApiEndpoint path="/api/events/<event_type>" method="post">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user