Hello guys,
I need to convert a working POST request to rest_command in Home Assistant configuration.yaml file.
This is the working POST request:
POST /management-api/v1/sims/ICCID/sms HTTP/1.1
Accept: application/json
Content-Type: application/json;charset=UTF-8
Authorization: Bearer TOKEN
Host: api.1nce.com
Content-Length: 47
{"source_address":"1234567890","udh":"STOC:OK"}
I tried the following so far:
#configuration.yaml entry
rest_command:
rv_restore_fuel:
url: https://api.1nce.com/management-api/v1/sims/ICCID/sms
method: POST
headers:
authorization: Bearer TOKEN
accept: "application/json"
payload: '{"source_address":"1234567890","udh":"STOC:OK"}'
content_type: application/json; charset=utf-8
but I got Error 401 in the logs:
WARNING (MainThread) [homeassistant.components.rest_command] Error. Url: https://api.1nce.com/management-api/v1/sims/ICCID/sms. Status code 401. Payload: b'{"source_address":"1234567890","udh":"STOC:OK"}'
I tried different type of quotes for the authorisation header, but the error is all the same.