Upload

Asynchronously uploads images from a list of URLs. The synchronous response contains the numbers of upload tasks.

Input data

The input data structure in JSON is shown below.

{
   "method": "AdImage",
   "param": {
      /* AdImageRequest */
      "Action": (string),
      "AdImageURLData": [
         {  /* AdImageURL */
            "Login": (string),
            "URL": (string),
            "Name": (string)
         }
         ...
      ]
   }
}

Parameters are described below.

Parameter Description Required
AdImageRequest object
Action Action: Upload. Yes
AdImageURLData Array of AdImageURL objects (no more than 10,000) containing information about images being uploaded. Yes
AdImageURL object
Login

Username of the client who owns the image.

For advertisers, this parameter is ignored.

For agencies
URL Image link. Yes
Name Caption for the image (any description). Yes

Output data

Attention. An error when creating an upload task (adding to the queue) for one of the images does not cause the entire operation to be canceled and does not affect the successful creation of upload tasks for the other images.

The output data structure in JSON is shown below.

{
   "data": {
      /* AdImageResponse */
      "ActionsResult": [
         {  /* AdImageActionResult */
            "AdImageUploadTaskID": (int),
            "Errors": [
               {  /* Error */
                  "FaultCode": (int),
                  "FaultString": (string),
                  "FaultDetail": (string)
               }
               ...
            ],
         }
         ...
      ]
   }
}

Parameters are described below.

Parameter Description
AdImageResponse object
ActionsResult

Array of AdImageActionResult objects. Each object corresponds to an item in the AdImageURLData input array and contains:

  • The number of the upload task, if the image was successfully added to the queue.
  • The Errors array, if an error occurred.

The items in the array are in the same order as the objects in the AdImageURL input array.

AdImageActionResult object
AdImageUploadTaskID Number of the created upload task. This number can be used for checking the upload status using the CheckUploadStatus action.
Errors Array of Error objects — errors that occured when adding images to the upload queue.
Error object
FaultCode Error code.
FaultString Textual message about the error.
FaultDetail Detailed description of the reason for the error.

Examples of input data

Python

{
   'Action': 'Upload',
   'AdImageURLData': [
      {
         'Login': 'agrom',
         'URL': 'http://site.ru/files/image001.png',
         'Name': u'Elephants: new collection'
      },
      {
         'Login': 'agrom',
         'URL': 'http://site.ru/files/image002.png',
         'Name': u'Elephants: certification and care'
      },
      {
         'Login': 'larry',
         'URL': 'http://example.net/files/pic.png',
         'Name': u'Stock up on peanuts'
      }
   ]
}

PHP

array(
   'Action' => 'Upload',
   'AdImageURLData' => array(
      array(
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image001.png',
         'Name' => 'Elephants: new collection'
      ),
      array(
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image002.png',
         'Name' => 'Elephants: certification and care'
      ),
      array(
         'Login' => 'larry',
         'URL' => 'http://example.net/files/pic.png',
         'Name' => 'Stock up on peanuts'
      )
   )
)

Perl

{
   'Action' => 'Upload',
   'AdImageURLData' => [
      {
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image001.png',
         'Name' => 'Elephants: new collection'
      },
      {
         'Login' => 'agrom',
         'URL' => 'http://site.ru/files/image002.png',
         'Name' => 'Elephants: certification and care'
      },
      {
         'Login' => 'larry',
         'URL' => 'http://example.net/files/pic.png',
         'Name' => 'Stock up on peanuts'
      },
   ]
}