BannerMassAction

/api/v2/banners/mass_action.json

The resource enables you to update statuses of a large number of banners simultaneously (200 banners per request maximum). The process is transaction-based, so if the update of at least one object ends with an error, then none of the updates is applied.

Used object: BannerMassAction

POST

The request body has the following structure:


   [
       {
           "id": <banner_id\>,
           "status": <new_status_value\>
       },
       {
           ...
       },
   ]

where <banner_id> is a banner identifier; <new_status_value> are status new value. The "id" field is required. You can change properties (parameters) of a deleted banner. To do this, restore the banner by specifying the "blocked" or "active" value in the "status" field of the request. Request example:


   POST /api/v2/banners/mass_action.json

   [
       {
           "id": 123456,
           "status": "active",
       },
       {
           "id": 234567,
           "status": "blocked"
       },
   ]

A successful request returns a response with status 204.

Possible errors:

  1. The maximum number of banners per request is exceeded:

   {
       "error": {
           "message": "Too much items. Limit is 200",
           "code": "limit_exceeded"
       }
   }
  1. The request contains non-existent banners:

   {
       "error": {
           "message": "Unknown banners: 144, 42, 100500",
           "code": "unknown_banners"
       }
   }
  1. An attempt to update a deleted banner without specifying its status:

   {
       "error": {
           "banners": [
               "arguments": {
                   "id": <banner_id\>
               }
               "code": "banner_deleted",
               "message": "Banner is deleted",
               "fields": {}
           ]           "message": "Validation failed",
           "code": "validation_failed"
       }
   }

where <banner_id> is the identifier of the affected banner.