Page 1 of 1

JSON update status with space / bad request

Posted: Sunday 04 June 2017 11:02
by vaevictis
Hello,

Fairly basic question, how can I escape a string so that a white space is accepted inside a string?

When the stlVal is "Geen vraag" I get a 400 Reason: Bad Request, offcourse I can change it to "Geen_vraag" to get it working.

def Domoticz(strIdx, strVal, strDesc = '', strWP_ID = ''):
strJson='/json.htm?type=command&param=udevice&idx='+strIdx+'&svalue='+strVal

Re: JSON update status with space / bad request

Posted: Sunday 04 June 2017 12:50
by jvdz
You should convert strings to urlencoded string. A space will translate to %20.

Jos