i00
(Kris Bennett)
1
Hi,
I am attempting to use the API (currently just through Postman) and have a bearer setup.
I can get info on the device by using:
curl --location --request GET 'http://XXXX/api/states/light.study_cd_rack_light' \
--header 'Authorization: Bearer XXXX'
However when I try to change this to toggle it:
curl --location --request POST 'http://XXXX/api/services/light/toggle' \
--header 'Authorization: Bearer XXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"entity_id": "light.study_cd_rack_light"
}'
I just get:
405: Method Not Allowed
Any ideas?
Thanks in advance K
VDRainer
(🍻)
2
The example in the API docs works for me.
curl -X POST -H "Authorization: Bearer ABCDEFGH" \
-H "Content-Type: application/json" \
-d '{"entity_id": "switch.christmas_lights"}' \
http://localhost:8123/api/services/switch/turn_on
i00
(Kris Bennett)
3
@VDRainer, doesn’t that appear to be the equivalent to what I have… ??
aidbish
(Adrian)
4
must be something wrong with how postman sending, i just tried and was able to toggle my light
curl -X POST -H "Authorization: Bearer eyxxxx" \
-H "Content-Type: application/json" \
-d '{"entity_id": "light.family_room_3"}' \
https://xxxx.xxxxxx.xxx/api/services/light/toggle