Hi
Can you please help me with httpclient API call. I am new to this and seems to be stuck.
I genetrated a JSON file using JSONGenerator object and the file is in the correct format.
I need to call an API that is expecting a JSON string.
How to pass the JSON string in my API call?
the call code is below
Please help
Thanks
Malek
HttpClient lhc_Client
lhc_Client = Create HttpClient
// Set request header
lhc_Client.SetRequestHeader("Accept", "*/*")
lhc_Client.SetRequestHeader("Accept-Encoding", "gzip")
lhc_Client.SetRequestHeader("Accept-Language", "en")
lhc_Client.SetRequestHeader("Connection", "keep-alive")
lhc_Client.SetRequestHeader("User-Agent", "Chrome/60.0.3112.113")
lhc_Client.SetRequestHeader("Cache-Control", "no-cache")
lhc_Client.SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
ls_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
lhc_Client.SetRequestHeader( "Authorization", " x-api-key" + ls_key)
li_Return = lhc_Client.SendRequest("POST", "https://shipper.qa.ptmx.io/loads")
If li_Return = 1 And lhc_Client.GetResponseStatusCode() = 200 Then
lhc_Client.GetResponseBody(ls_key)
MessageBox ("Hello" ,ls_key )
else
lhc_Client.GetResponseBody(ls_key)
MessageBox ("hello fail" ,ls_key )
End If
Destroy ( lhc_Client )