#POST to nabu casa api?

1 messages · Page 1 of 1 (latest)

hexed sable
#

I'm trying to remotely change a state in ha by sending a post request. This works fine when using my local ha instance but doesn't when I try to connect remotely.

I'm using this command:
C:\Users\User>curl -X POST "http://xxxxxxxxx.ui.nabu.casa:8123/api/states/input_select.tomi_home" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d "{"state": "AWAY"}"

I get this error:
curl: (28) Failed to connect to xxxxxxxxx.ui.nabu.casa port 8123 after 21046 ms: Couldn't connect to server

alpine yarrow
#

try changing to https and removing the port like this
https://xxxxxxxxx.ui.nabu.casa/api/states/input_select.tomi_home

hexed sable
#

Great, that worked, thanks a lot!!

#

Since I'm planning to send thsi command automatically from my phone I was wondering whether there are any substantial security risks when posting this data including the token

alpine yarrow
#

there is always risk to things being exposed but its pretty minimal

foggy stag
#

yes you want to keep that private

alpine yarrow
#

probably dont want to publically put your endpoints around too much though in case people mess with you 😛

#

xxx'ing out stuff when asking for support is definetly a good call