Add content-type to curl (#531)

This commit is contained in:
Fabian Affolter 2016-06-04 17:38:33 +02:00
parent 36f0192053
commit 258d4172d8
6 changed files with 42 additions and 20 deletions

View file

@ -40,7 +40,8 @@ To check if the sensor is working, use again `curl` to retrieve the [current sta
```bash
$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
http://localhost:8123/api/states/binary_sensor.radio
-H "Content-Type: application/json" \
http://localhost:8123/api/states/binary_sensor.radio
{
"attributes": {
"friendly_name": "Radio"
@ -74,6 +75,6 @@ print(response.text)
```bash
$ http -v POST http://localhost:8123/api/states/binary_sensor.radio \
x-ha-access:YOUR_PASSWORD state=off \
x-ha-access:YOUR_PASSWORD content-type:application/json state=off \
attributes:='{"friendly_name": "Radio"}'
```

View file

@ -27,6 +27,7 @@ Using the [REST API](/developers/rest_api/#post-apiservicesltdomainltservice) to
```bash
$ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"payload": "Test message from HA", "topic": "home/notification"}' \
http://IP_ADDRESS:8123/api/services/mqtt/publish
```

View file

@ -31,7 +31,8 @@ You should choose a unique device name (DEVICE_NAME) to avoid clashes with other
For a quick test `curl` can be useful to "simulate" a device.
```bash
$ curl -XPOST -H "x-ha-access: YOUR_PASSWORD" \
$ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"state": "20", "attributes": {"unit_of_measurement": "°C", "friendly_name": "Bathroom Temp"}}' \
http://localhost:8123/api/states/sensor.bathroom_temperature
```
@ -40,7 +41,8 @@ Use again `curl` to retrieve the [current state](/developers/rest_api/#get-apist
```bash
$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \
http://localhost:8123/api/states/sensor.bathroom_temperature
-H "Content-Type: application/json" \
http://localhost:8123/api/states/sensor.bathroom_temperature
{
"attributes": {
"friendly_name": "Bathroom Temp",

View file

@ -32,7 +32,7 @@ Configuration variables:
Check if you are able to access the device located at `http://IP_ADRRESS`. The details about your switch is provided as a JSON response.
```bash
$ curl -X GET http://IP_ADDRESS/report
$ curl -X GET -H "Content-Type: application/json" http://IP_ADDRESS/report
{
"power": 0,
"relay": false