Formats for input and output data

Input data format

Input data structures for POST and PUT methods are passed in the request body. The input structures match the output structures of GET methods for the corresponding resources.

Tip.

To form input structures correctly for POST and PUT methods, call the GET method for an existing resource. Copy the structure you receive and set the field values as needed.

POST and PUT methods in the API accept data in JSON format.

The input data format is specified in the HTTP Content-Type header.

Acceptable header values:

Output data format

The API returns responses in UTF-8 encoding. Responses are in JSON format.

For example, the following request will return a list of available segments:

GET https://api-audience.yandex.com/v1/management/segments

Example:

GET /v1/management/segments HTTP/1.1
        Host: api-audience.yandex.com
        Authorization: OAuth <access_token>
        Content-Type: application/json
        Content-Length: 127

        {
        "segments" : [{
        "id" : 1111,
        "name" : "numbers",
        ...
        },
        {
        "id" : 1122,
        "name" : "e-mail",
        ...
        }
        ]
        }

For debugging, results can be formatted. To get a formatted response, pass the pretty parameter set to 1 in any type of request.

GET https://api-audience.yandex.com/v1/management/segments?pretty=1
        PUT https://api-audience.yandex.com/v1/management/segments?pretty=1

When DELETE methods are completed successfully, the API returns the HTTP status with the code 200. If the HTTP status contains a different code, deletion was not performed.