hi I am trying to post json data using poststring method. It is returning always as false and the poststring method is not hitting the url at all.(ResponseError. Reason: , Response: )
However when tested from postman it works fine. Kindly help me in solving the issue.
the getmethod https://dapiserver.herokuapp.com/12345/orders?token=1000 is working fine
However when tested from postman it works fine. Kindly help me in solving the issue.
B4X:
B4A
Main.cLocalIp="https://dapiserver.herokuapp.com"
j2.PostString(Main.cLocalIp & "/neworder", "")
j2.GetRequest.SetHeader("order", ord) ' ord is a map
j2.GetRequest.SetHeader("items", s) ' s is a map
j2.GetRequest.SetContentType("application/json")
Wait For (j2) JobDone(j2 As HttpJob)
If j2.Success Then
Log(j2.GetString)
'log("accepted " & j.GetString)
Else
Log(j2.ErrorMessage)
End If
j2.Release
B4X:
j2.Download(Main.cLocalIp & "/513002/orders?token=2c76584995a8450eaa2d68c7496d0d30")
j2.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36")
j2.GetRequest.SetHeader("Content-Type", "application/json")
Wait For (j2) JobDone(j2 As HttpJob) ' ---- works fine
B4X:
postman code
https://dapiserver.herokuapp.com/neworder
{
"order": {
"aggregator": 1,
"aggname": "Test",
"orderno": "764674764",
"restaurantid": "12345",
"token": "1000",
"discount": "0",
"packingcharges": "0"
},
"items": [
{
"aggitemcode": "677",
"positemcode": null,
"item": "Upma",
"variant": "null",
"qty": 1,
"amount": "73"
},
{
"aggitemcode": "644",
"positemcode": null,
"item": "Tea Without Sugar",
"variant": "null",
"qty": 1,
"amount": "37"
}
]
}