API for Publishers
Gateway
Our HTTP+JSON API is accessible from the Portal at /api/rpc. Contact support if you require any assistance.
Most up-to-date languages have HTTP and JSON modules or libraries, which allows you to easily interact with our services.
References
The quickest way to find out what are the supported methods is through the system.listMethods introspection from commonly implemented by many XML-RPC clients and servers. For HTTP+JSON, send your request to /api/rpc?v=2&s=system&m=listMethods&no_auth.
For further explanations on the API, please contact support for the API Reference Documentation.
Usage
Parameters
The supported GET parameters are as followed:
- v - The API major version number. As of writing, the value is 2. It must always be provided to the server.
- s - The service name, e.g.
resource. - m - The method name, e.g.
get. - a - The arguments in JSON format, e.g.
['username', 'secret', ...]. - noauth - Use this if authentication is not required, e.g. during introspection.
Note that, if POST is used (usually for the reason of security and data size), arguments must be provided as the request content.
Authentication
Except methods of system namespace, all methods require a username and API key (generated through the Portal) for identification and authentication purposes. For better credential control, we do not recommend you to share the same key for all API clients.
The first two parameters of a method are mandatory and meant for your credentials, e.g. ?v=2&s=surrogate&m=get&a=['username', 'secret', ...]. Your username is your email registered with our system (unless you customized it), contact support otherwise if it does not work.
Examples
Examples in PHP
Retreiving a list of validating Resources
$url = "{$host}/api/rpc";
$url .= '?v=2&s=resource&m=get&a=';
$url .= '["your@email.com/31337","foobar",{"status":"VALIDATING"}]';
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$o = curl_exec($c);
curl_close($c);
if($o){
$resources = json_decode($o);
// ...
}
