2g Circle API

171 views
Skip to first unread message

Jimbo

unread,
Mar 23, 2017, 2:49:01 PM3/23/17
to XMPie Interest Group
Hi Folks,

I'm starting to use the Circle 2g API.  

The documentation can be found here.


I can get system controller to work which generates a security token.

All other Post and Get calls use a subscription id and never reference the security token.

What is the parameter name for security token to pass during a session?




$service_url = 'https://eu.xmcircle.com/CloudAPI/v1/system/login';
$curl
= curl_init($service_url);
$curl_post_data
= array(
       
'UserName' => 'myusername',
       
'UserPassword' => 'mypassword'
);


The above works great and generates a token.

Of course when using a GET to list all projects for a user I get invalid credentials because nowhere in the documentation does it state what the parameter is for security token.
Subscription ID isn't the security token from what I can tell.

$service_url = 'https://eu.xmcircle.com/CloudAPI/v1/'.$subscription_id.'/projects?projectType=1';
$curl
= curl_init($service_url);
$data_string
= json_encode($curl_post_data);
curl_setopt
($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response
= curl_exec($curl);

Thanks so much for you help.



Jimbo

unread,
Mar 23, 2017, 3:47:28 PM3/23/17
to XMPie Interest Group
fyi.  I've tried adding the following to the curl header..to no avail.


curl_setopt
($curl, CURLOPT_HTTPHEADER, array('circle-token:'.  $token));
curl_setopt
($curl, CURLOPT_HTTPHEADER, array('Authentication:'.  $token));
curl_setopt
($curl, CURLOPT_HTTPHEADER, array('PRIVATE-TOKEN:'.  $token));

Jimbo

unread,
Apr 4, 2017, 10:20:27 AM4/4/17
to XMPie Interest Group
 Support got back to me.  This wasn't documented in their Circle API.

You need to pass back the secure token as

curl_setopt
($curl, CURLOPT_HTTPHEADER, array('Authentication: Circle '.  $token));



In C# using RestSharp it would be like this

request.AddParameter("Authorization", string.Format("Circle " + strToken), ParameterType.HttpHeader);








Reply all
Reply to author
Forward
0 new messages