Developers
API Interfaces
REST

REST Interface

Resource call

Link to the resource consists of several parts. For example, /api/rest/webmaster/xml/offers/{type}/{start}/{limit}/{sort}/{sort_type}/{q}/{geo}/{platforms}/{categories}/{traffic_types}?remote_auth=00000000000000000000000000000000

Where:

  • /api/rest/webmaster/ - link to webmaster's resource library
  • /xml/ - requested data format. Supported formats - xml, json and csv
  • /offers/ - resource name. All resources are described in documentation
  • followed by the input parameters
  • remote_auth - required user's access key. It can be obtained via OAuth-authorization, or you can find it in webmaster's profile.
Input parameters

There are several ways to transfer parameters for GET requests:

  • In URL - /api/rest/webmaster/xml/offers/{type}/{start}/{limit}/{sort}/{sort_type}/{q}/{geo}/{platforms}/{categories}/{traffic_types}
  • In GET-parameters - /api/rest/webmaster/xml/offers?type=web&start=0&limit=15
  • Mixed type - /api/rest/webmaster/xml/offers/{type}/{start}?limit=15&sort=cpl&sort_type=desc

Multiple values of one parameter are transferred separated by commas. For example, geo=186,150,37.

Attention! Values of GET-parameters shall override the values of these same parameters in URL.

For PUT and POST requests parameters in HTTP-package body shall be transferred in the same order in which they are described in XSD-scheme. Presentation format of the parameters must match the type of the requested data - XML or JSON.

Check the example of PUT-request in XML and JSON formats:
  • <setUserLanguageRequestData>
    • <lang>en</lang>
  • </setUserLanguageRequestData>
  • {
    • "lang": "en"
  • }
Response format

Regardless of the format of interaction with the API, the data structure contained in the methods' response is as follows:

  • status - status of the query;
  •  
  • Possible responses:
    • 200 - the query was successfully performed;
    • 204 - No content. A lengthy operation was launched; its code is shown in the request_id field. The result of the operation may be obtained after some time with request_id identifier;
    • 400 - Incorrect incoming parameters;
    • 403 - Incorrect apiKey or insufficient access rights;
    • 404 - Requested data not found;
    • 500 - Internal error.
    •  
    • This status code can be duplicated in The HTTP status code
  •  
  • error - error message;
    • If the query is successful, the value will be empty.
  •  
  • request_id - operation identifier. If status = 204, then the request_id field must contain a number greater than 0;
  • data - array with the data returned for the method called. If the query fails it will be empty.
Example:
  • {
    • "status": 204,
    • "error": "",
    • "request_id": 200132
    • "data": [ ],
  • }

The content of the data block is described in the WSDL/XSD.