JSON update status with space / bad request Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
vaevictis
Posts: 12
Joined: Thursday 26 May 2016 7:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

JSON update status with space / bad request

Post 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
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: JSON update status with space / bad request

Post by jvdz »

You should convert strings to urlencoded string. A space will translate to %20.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest