Training
For clients
Загружается...
A resource that allows you to create a new ad campaign or retrieve a list of existing ad campaigns.
Used object: AdPlan
Retrieving a list of ad campaigns
Request example
GET /api/v2/ad_plans.json
Response example
{ "count": 3, "offset": 0, "items": [ { "id": 6617841, "name": "New campaign 2022-07-15 17:53" }, { "id": 6711647, "name": "New campaign 2022-08-16 19:49" }, { "id": 6711665, "name": "New campaign 2022-08-16 19:51" } ] }
Available fields are described in AdPlan.
The resource supports pagination using the limit and offset parameters.
/api/v2/ad_plans.json?limit=10
/api/v2/ad_plans.json?limit=5&offset=15
Filters
/api/v2/ad_plans.json?_id=6617841 /api/v2/ad_plans.json?_id__in=6617841,6711647
/api/v2/ad_plans.json?_status=active /api/v2/ad_plans.json?_status__ne=active /api/v2/ad_plans.json?_status__in=active,blocked
Sorting
/api/v2/ad_plans.json?sorting=id - ascending /api/v2/ad_plans.json?sorting=-id - descending
/api/v2/ad_plans.json?sorting=name - ascending /api/v2/ad_plans.json?sorting=-name - descending
/api/v2/ad_plans.json?sorting=status - ascending /api/v2/ad_plans.json?sorting=-status - descending
/api/v2/ad_plans.json?sorting=status,name,-id
Creating an ad campaign
Request example:
POST /api/v2/ad_plans.json { "name": "My new campaign", "status": "active", "date_start": "2022-04-01 00:00:00", "date_end": "2022-04-15 00:00:00", "autobidding_mode": "max_goals", "budget_limit_day": "1000", "budget_limit": "5000", "enable_utm": "False", "enable_offline_goals": "False", "objective": "playersengagement", "ad_groups": [] }
Response example:
HTTP 200 { "id": 9826424 }
The response always contains the id and ad_groups fields (if the campaign is created with groups).
Important: ad_groups is not supported in fields and will return an error.
A campaign can be created with one of the following statuses: active, blocked, deleted.
If the status is not provided, the active status is set.
Possible response codes
Possible error codes:
In general, an error message has the following format:
{ "error": { "fields": { "<field_name_1\>": { "message": "<error_message_1\>", "code": "<error_code_1\>" }, "<field_name_2\>": { "message": "<error_message_2\>", "code": "<error_code_2\>" } }, "message": "Validation failed", "code": "validation_failed" } }
where field_name_N is the name of the field where the error occurred, error_message_N is the error description, and error_code_N is the error code.
Example:
{ "error": { "fields": { "audit_pixels": { "message": "Error validating audit pixels urls", "code": "audit_pixel_invalid_urls" } }, "message": "Validation failed", "code": "validation_failed" } }