appie21 Active Member Licensed User Longtime User Sep 24, 2016 #1 Hello I try to sent some data to my Hue lamps I need to do a PUT action I use Dim req As HttpRequest When I press a button I do: B4X: string1 = "{" & Chr(34) & "devicetype" & Chr(34) & ":" & Chr(34) & "Albert" & Chr(34) & "}" on= "http://192.168.0.12/api/mAuspDhgPKALjmuonHyPAe-dfqvzd3qqBo9uyrvo/lights/10/state" status = "{" & Chr(34) & "on" & Chr(34) & ":false}" b = status.GetBytes("UTF8") req.InitializePut2(on, b) How can I get this to work I guss I do something wrong by convert it to a byte,...
Hello I try to sent some data to my Hue lamps I need to do a PUT action I use Dim req As HttpRequest When I press a button I do: B4X: string1 = "{" & Chr(34) & "devicetype" & Chr(34) & ":" & Chr(34) & "Albert" & Chr(34) & "}" on= "http://192.168.0.12/api/mAuspDhgPKALjmuonHyPAe-dfqvzd3qqBo9uyrvo/lights/10/state" status = "{" & Chr(34) & "on" & Chr(34) & ":false}" b = status.GetBytes("UTF8") req.InitializePut2(on, b) How can I get this to work I guss I do something wrong by convert it to a byte,...
Erel B4X founder Staff member Licensed User Longtime User Sep 24, 2016 #2 1. Use smart strings if you want to include quotes: https://www.b4x.com/search?query=Smart+Strings+Literal 2. Use JsonGenerator from the JSON library if you want to create a JSON string. https://www.b4x.com/search?query=JSON 3. Never use HttpClient directly. Use OkHttpUtils2. Upvote 0
1. Use smart strings if you want to include quotes: https://www.b4x.com/search?query=Smart+Strings+Literal 2. Use JsonGenerator from the JSON library if you want to create a JSON string. https://www.b4x.com/search?query=JSON 3. Never use HttpClient directly. Use OkHttpUtils2.
appie21 Active Member Licensed User Longtime User Sep 24, 2016 #3 May thanks monday I will try Upvote 0
appie21 Active Member Licensed User Longtime User Sep 24, 2016 #4 --Got it Last edited: Sep 24, 2016 Upvote 0