Not too sure what I've messed up here. I'm trying to send a command to an API to control my aircon system


Hi all,

So If I send the following command via curl in a terminal, it does work fine:

curl \
-H 'Host:' \
-H 'Accept: application/json' \
-H 'Accept-Language: en-AU;q=1' \
-H 'User-Agent: nxgen-ios/1.1.2 (iPhone; iOS 12.1.4; Scale/3.00),SignalR.Client.iOS/ (iPhone 12.1.4)' \ 
-H 'Authorization: Bearer ABCDE' \ 
-d '{"command":{"UserAirconSettings.isOn”:true,”type":"set-settings"}}' \ 
--compressed '’

This turns on my aircon and gives the following response:


The below flow (ID's redacted obviously) doesn't work:

[{"id":"7eb9f18e.d50aa","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"ed9d0ae0.1660a8","type":"inject","z":"7eb9f18e.d50aa","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":356.5,"y":302,"wires":[["a718d353.9a125"]]},{"id":"a718d353.9a125","type":"function","z":"7eb9f18e.d50aa","name":"set payload and headers","func":"msg.payload = '{\"command\":{\"UserAirconSettings.isOn”:true,”type\":\"set-settings\"}}';\nmsg.headers = {};\nmsg.headers['Host'] = '';\nmsg.headers['Accept'] = 'application/json';\nmsg.headers['Accept-Language'] = 'en-AU;q=1';\nmsg.headers['User-Agent'] = 'nxgen-ios/1.1.2 (iPhone; iOS 12.1.4; Scale/3.00),SignalR.Client.iOS/ (iPhone 12.1.4)';\nmsg.headers['Authorization'] = 'Bearer ABCDE'\nreturn msg; ","outputs":1,"noerr":0,"x":606,"y":290,"wires":[["baafbbe0.99deb8"]]},{"id":"baafbbe0.99deb8","type":"http request","z":"7eb9f18e.d50aa","name":"Token Response","method":"POST","ret":"txt","paytoqs":false,"url":"","tls":"","proxy":"","x":847,"y":290,"wires":[["14969213.2f520e"]]},{"id":"14969213.2f520e","type":"debug","z":"7eb9f18e.d50aa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1088.5,"y":280,"wires":[]}]    

And gives the following error:

"An internal server error prevented this request from being successfully processed. Error Reference: 48b9312c-4d98-4784-a84a-ff3cb7985010"

Previously when I've received a similar error via curl in the terminal, it's because I've used the wrong quotation mark or something similar. Basically it seems to mean that the request is getting through OK but there's something wrong with the formatting maybe?

Just hoping someone can see something obvious I'm doing wrong, as I only started playing with Node-Red yesterday so I'm fumbling through it.

EDIT: I should say that I know I'm using --compressed in the curl statement, but it's not necessary, it works fine without it. It's just a product of testing.




Spot the deliberate mistake (the quote after isOn is not valid)

1 Like


and also before the word type

1 Like


Ugh! Thanks guys, it's so much clearer typed out like that, I must have stared at it 1000 times and not noticed.

Works great now!

1 Like