<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>15 Apr 2018 19:42:00 Z</lastBuildDate><pubDate>15 Apr 2018 18:26:00 Z</pubDate><description>Hi everybody,&#13;
I need some help from some API rest gurus.&#13;
&#13;
I cannot figure out yet how to get a Response in JSON format.&#13;
This is my code now:&#13;
&#13;
oRequest is httpRequest&#13;
oResponse is httpResponse&#13;
&#13;
oRequest..URL = "https://sandbox.api.payulatam.com/payments-api/4.0/service.cgi"&#13;
oRequest..Method = httpPost&#13;
oRequest..ContentType = "application/json"&#13;
&#13;
// Request content&#13;
oRequest..Content = [&#13;
{&#13;
"test": false,&#13;
"language": "en",&#13;
"command": "GET_PAYMENT_METHODS",&#13;
"merchant": {&#13;
"apiLogin": "pRRXKOl8ikMmt9u",&#13;
"apiKey": "4Vj8eK4rloUd272L48hsrarnUA"&#13;
}&#13;
}&#13;
]&#13;
&#13;
// Runs the request and retrieves the response&#13;
oResponse = HTTPSend(oRequest)&#13;
&#13;
So "oResponse" has a property "ContentType" but this one it is ReadOnly... cannot be changed.&#13;
&#13;
The result I get looks like this: https://www.screencast.com/t/tGWpVfUTF.&#13;
&#13;
So I have tried this:&#13;
vResultVar is Variant = JSONToVariant(oResponse..Content)&#13;
&#13;
but I get the error message:&#13;
JSONToVariant function called.&#13;
Invalid JSON format&#13;
&#13;
So it seems the result it is not in JSON format :-(.&#13;
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.&#13;
&#13;
TIA.&#13;
&#13;
Regards</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call/read.awp</link><title>[WB 22] Get a JSON response in API rest call</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call-65233/read.awp</comments><pubDate>15 Apr 2018 19:42:00 Z</pubDate><description>Hi,&#13;
&#13;
Looks to me that the result is XML&#13;
&#13;
Json ==&gt; Javascript Object Notation&#13;
&#13;
It has the curly brackeds and stuff not the …</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call-65233/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call-65233/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call/read.awp">[WB 22] Get a JSON response in API rest call</source><title>Re: [WB 22] Get a JSON response in API rest call</title></item><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call-65234/read.awp</comments><pubDate>15 Apr 2018 00:11:00 Z</pubDate><description>I answer myself... I have read the help again and I figure out I could use this in the Header property :&#13;
&#13;
oRequest..Header["Ac…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call-65234/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call-65234/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/65230-22-get-json-response-api-rest-call/read.awp">[WB 22] Get a JSON response in API rest call</source><title>Re: [WB 22] Get a JSON response in API rest call</title></item></channel></rss>
