Page 1 of 1

JSON API errors

Posted: Monday 18 March 2024 11:26
by philchillbill
I can use e.g.

Code: Select all

/json.htm?type=command&param=switchlight&idx=655&switchcmd=Toggle
via either a browser or nodejs and axios.get and it always works. However, if I try e.g.

Code: Select all

/json.htm?type=command&param=setused&idx=601&setpoint=15.0&mode=FollowSchedule&used=true
then it works via the browser as evidenced by

{
"status" : "OK",
"title" : "SetUsed"
}

but fails via nodejs and axios.get, as evidenced by

{ status: 'ERR' }

Does anybody have any idea why going via the browser would make a difference? It's a shame that the only error message is 'ERR' as it doesn't tell me much...

Re: JSON API errors

Posted: Monday 18 March 2024 12:38
by jvdz
Something to do with URL-Encoding, which is performed automatically with the browser?