Hi everybody,
I need some help from some API rest gurus.
I cannot figure out yet how to get a Response in JSON format.
This is my code now:
oRequest is httpRequest
oResponse is httpResponse
oRequest..URL = "[sandbox.api.payulatam.com];
oRequest..Method = httpPost
oRequest..ContentType = "application/json"
// Request content
oRequest..Content = [
{
"test": false,
"language": "en",
"command": "GET_PAYMENT_METHODS",
"merchant": {
"apiLogin": "pRRXKOl8ikMmt9u",
"apiKey": "4Vj8eK4rloUd272L48hsrarnUA"
}
}
]
// Runs the request and retrieves the response
oResponse = HTTPSend(oRequest)
So "oResponse" has a property "ContentType" but this one it is ReadOnly... cannot be changed.
The result I get looks like this: [www.screencast.com].
So I have tried this:
vResultVar is Variant = JSONToVariant(oResponse..Content)
but I get the error message:
JSONToVariant function called.
Invalid JSON format
So it seems the result it is not in JSON format :-(.
I do not know how to indicate in my code that the result should be in JSON format. Should be something like "Accept: application/json" but I do not know where can I place this in my code if possible.
TIA.
Regards
I need some help from some API rest gurus.
I cannot figure out yet how to get a Response in JSON format.
This is my code now:
oRequest is httpRequest
oResponse is httpResponse
oRequest..URL = "[sandbox.api.payulatam.com];
oRequest..Method = httpPost
oRequest..ContentType = "application/json"
// Request content
oRequest..Content = [
{
"test": false,
"language": "en",
"command": "GET_PAYMENT_METHODS",
"merchant": {
"apiLogin": "pRRXKOl8ikMmt9u",
"apiKey": "4Vj8eK4rloUd272L48hsrarnUA"
}
}
]
// Runs the request and retrieves the response
oResponse = HTTPSend(oRequest)
So "oResponse" has a property "ContentType" but this one it is ReadOnly... cannot be changed.
The result I get looks like this: [www.screencast.com].
So I have tried this:
vResultVar is Variant = JSONToVariant(oResponse..Content)
but I get the error message:
JSONToVariant function called.
Invalid JSON format
So it seems the result it is not in JSON format :-(.
I do not know how to indicate in my code that the result should be in JSON format. Should be something like "Accept: application/json" but I do not know where can I place this in my code if possible.
TIA.
Regards