Content

/api/v2/content/(static|video|html5).json

The resource enables you to upload creatives that you can use for advertising. The creatives uploaded using this resource will be available only in the packages whose banner format has the "content" section.

Used object: Content

POST

The request should have the type multipart/form-data. For the static.json and video.json methods, the "data" structure must contain values for the width and height parameters of the source creative.

Static images must be uploaded to https://ads.vk.ru/api/v2/content/static.json.

Videos must be uploaded to https://ads.vk.ru/api/v2/content/video.json.

HTML5 creatives must be uploaded to https://ads.vk.ru/api/v2/content/html5.json The file must meet the requirements for HTML5 banners (https://sales.mail.ru/ru/russia/main/latest/technical/#a75).

Request example:


   curl -X POST -H "Authorization: Bearer LIDM…Io4Qj"  -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "file=@[object Object]" -F 'data={"width":1612, "height":980}' "https://ads.vk.ru/api/v2/content/static.json"

Response example:


    {
       "variants": {
           "original": {
               "url": "https://r.mradx.net/img/17/B36CF7.jpg",
               "width": 90,
               "height": 75,
               "size": 3339
           }
       },
       "id": 1084236
   }

In case of an error the following response is returned:


    {
        "error": {
            "code": "validation_failed",
            "fields": {
                "file": "<error\>"
            },
            "message": "Validation failed"
        }
    }

Possible errors for static.json and video.json:

  • {"code": "format_not_supported", "message": "Unsupported content format."}
  • {"code": "cannot_upload", "message": "Cannot upload content"}
  • {"code": "no_file", "message": "Content not found in the request. Request must have multipart/form-data type with "file" field."}
  • {"code": "broken_content", "message": "Content is broken"}
  • {"code": "content_too_large", "message": "Content is too large"}
  • {"code": "content_bad_size", "message": "Content has bad size"}

Possible errors for html5.json:

  • bad_archive - error opening zip archive;
  • no_html_file - the archive does not contain an html file;
  • too_many_html_files - the archive contains more than one html file;
  • invalid_file_name - invalid file name;
  • tag_unclosed - tag unclosed;
  • wrong_symbols - wrong symbols in url;
  • incorrect_ad_size - size of creative is not set in <meta name="ad.size">;
  • href_not_found - "a" tag must have "href" attribute;
  • null_symbol - Html contains NULL symbol;
  • external_css - external CSS contains links to resources;
  • validation_error - common API v2 validation error;

For error details, see the "message" field.