Value1="some value"
Value2="some other value"
post="{"+Chr(34)+"Key1"+Chr(34)+":"+Chr(34)+Value1+Chr(34)+","+Chr(34)+"Key2"+Chr(34)+":"+Chr(34)+Value2+Chr(34)+"}"
If http.AsyncPostFromString(post) Then
event = Wait(timeout, http.GetPort())
If Type(event) = "roUrlEvent" Then
response = event.GetString()
Else If event = invalid Then
? "AsyncPostFromString timeout"
http.AsyncCancel()
Else
? "AsyncPostFromString unknown event", event
End If
End If
if response <> invalid AND response <> ""
json = parseJSON(response)
"tim_beynart" wrote:
Using JSON formatting functions will not work, you have to generate your POST JSON manually using Chr(34) to insert the quotation marks.
Value1="some value"
Value2="some other value"
a={}
a["Key1"]=Value1
a["Key2"]=Value2
? FormatJSON(a)
'==>
{"Key1":"some value","Key2":"some other value"}
Tim, can you be more specific about what is not working for you?
Certainly, you do not have to manually format JSON in the general case.
"tim_beynart" wrote:
It's been quite some time since I messed with it, but IIRC, my request body was blank if I tried to use an AA converted to JSON using formatJSON. The case is not an issue, I wrote that example off the top of my head. I can try to dig up an example to demonstrate.
function params_to_query_string(params)
lst = []
for each item in params.items():
lst.push(item.key.escape() + "=" + item.value.escape())
next
return lst.join("&")
end function
a = {
userId: "test1"
sessionId: "test2"
categoryId: "test3"
}
Still I can't understand how to send body in post request