Hello,
I was looking at the forum for an answer but failed to find a solution.
What I am intending to do is to send a JSON request o my API. Task seems to be easy and the code is short:
postImageMap is just a map with some values. JSON string looks as follows:
This code runs in a service, trying to communicate with the API every now and then.
How can I debug it? JobDone is not fired so Log calls are not doing anything. I don't receive any error message. No idea how to fix it because I get no feedback. I tried the same JSON string with a REST client and it worked. It seems that http is NOT sending the request. Did I miss some kind of "http.fire" function or something?
I was looking at the forum for an answer but failed to find a solution.
What I am intending to do is to send a JSON request o my API. Task seems to be easy and the code is short:
B4X:
Dim JSONg As JSONGenerator
JSONg.Initialize(postImageMap)
Dim http As HttpJob
http.Initialize("http", Me)
http.Username = "someusername"
http.Password = "averysecurepassword"
http.PostString("http://1.1.1.1/api.php/image", JSONg.ToString)
http.GetRequest.SetContentType("application/json")
postImageMap is just a map with some values. JSON string looks as follows:
B4X:
{"Image":"Image","QRCode":"QRCode","Vorname":"Vorname","Gebdate":"30-01-1987","Strasse":"Strasse","ScanDate":"","SaveDate":"","PLZ":"13407","Standort_id":"0","ProgrammVersion":"","Device":{"Mac":"","DeviceName":"hyyy","DeviceKey":"yyyyu","DeviceType":""}}
This code runs in a service, trying to communicate with the API every now and then.
How can I debug it? JobDone is not fired so Log calls are not doing anything. I don't receive any error message. No idea how to fix it because I get no feedback. I tried the same JSON string with a REST client and it worked. It seems that http is NOT sending the request. Did I miss some kind of "http.fire" function or something?
Last edited: