Welcome on Adways step by step APIs overview.

All examples given in this "step by step" tutorial are using PHP 5 or more.

Those examples do not use any external PHP framework or depencies, except cURL module.

All requests must be done under authentification. Every single request needs to start with a Bearer access_token or Basic client_id:client_secret in the Authorization header in order to authentificate user.

Authentification

Headers for authentification are:

Using a temporary token for user

    // HTTP/1.1 standard headers
    Authorization: Bearer access_token_automatically_base64_encoded
    X-Token-Provider: TokenProviderCode

In the above description, the constant 'TokenProviderCode' will be provided by Adways.

Using client_id and client_secret

    // HTTP/1.1 standard headers
    Authorization: Basic api_key:api_secret

To get more information about request authentification, you can refer to: Authentification Pre-requisite steps.

Request Content-Type

Adways APIs requests must be done with content-type: application/json

Requests body

Parameters must be sent using json_encode method from PHP or equivalent parameters

    // PHP code
    $fields = array();
    $fields['name'] = 'Project name';
    $fields['media'] = (int) $mediaId;
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

APIs Responses

RESTFul services

All RESTFul APIs working on entities and collections uses HTTP/1.1 standard status codes for their returns

Standard codes, returned by each APIs can be:

    // main used HTTP status codes
    200 OK
    201 Created
    204 No Content
    400 Client Error
    401 Unauthorized
    403 Forbidden
    404 Not Found
    406 Not Acceptable
    415 Unsupported Media Type
    422 Unprocessable Entity

Full list of HTTP/1.1 status codes is available on Hypertext Transfer Protocol (HTTP) Status Code Registry

To get more details on returns of each API please refer to RESTFul and RPC APIs documentation

Alternatively use HTTP/1.1 standard status codes and specific json body responses under status code 200. To get more details on each API returns, please refer to RESTFul and RPC APIs documentation