Calling API to get JSON string

For a customer i need to call an API to get a JSON String. I didn’t succeed, doing this with xojo.

I know how to call the Interface with php:

header('Content-type: application/json');
define('API_ID', '1234');
define('API_KEY', 'abcdefghijk1234567890');
define('API_FORMAT', 'json'); #or xml
define('API_URL', 'https://api.service.tld/vxyz/'.API_FORMAT.'/'.API_ID.'/'.API_KEY.'/');

# Get statistics
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, API_URL.'ACD/Statistics/Agents');
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
echo curl_exec($ch);
curl_close($ch);

Running this code on a webserver i get the JSON-String in the browser.
I think i know how to parse this string in xojo, but i don’t have an idea how to call the API, and then parse the result, and getting the data from the string.

Thanks for any kind of tip…

For a synchronous request, start here:

http://documentation.xojo.com/index.php/HTTPSecureSocket

And look in the examples folder. There’s at least one example that talks about secure sockets.

Thanks Greg,
i succeded with one of the examples.

First i didn’t know how to use the options, but now it’s clear for me. I just had to put together the variables to one URL-String.