add

Synchronously uploads images as binary data.

  1. Restrictions
  2. Request
  3. Response
  4. Example

Restrictions

The maximum number of images per advertiser is 1000 + 2 × the number of ads.

Maximum of 100 images per method call. We recommend uploading no more than 3 images per call.

If images are identical, only one image is created.

Restrictions on the size of the image are listed in Requirements for images uploaded via the API.

Request

Request structure in JSON format:

{
  "method": "add",
  "params": { /* params */
    "AdImages": [{  /* AdImageAddItem */
      "ImageData": (base64Binary), /* required */
      "Name": (string) /* required */
    }, ... ] /* required */
  }
}
ParameterTypeDescriptionRequired
Params structure (for JSON) / AddRequest structure (for SOAP)
AdImagesarray of AdImageAddItemImages to add (maximum of 100).Yes
AdImageAddItem structure
ImageDatabase64Binary

Image to upload: base64-encoded binary data.

Note.

When using the SOAP library, place the binary data directly in this field, and the library automatically encodes it as base64 during transmission.

When using JSON format, first encode the binary data in base64, then pass it as a string.

Yes
NamestringCaption for the image. Maximum of 255 characters.Yes

Response

Response structure in JSON format:

{
  "result": { /* result */
    "AddResults": [{  /* AdImageActionResult */
      "AdImageHash": (string),
      "Warnings": [{  /* ExceptionNotification */
        "Code": (int), /* required */
        "Message": (string), /* required */
        "Details": (string)
      }, ... ],
      "Errors": [{  /* ExceptionNotification */
        "Code": (int), /* required */
        "Message": (string), /* required */
        "Details": (string)
      }, ... ]
    }, ... ]
  }
}
ParameterTypeDescription
Result structure (for JSON) / AddResponse structure (for SOAP)
AddResultsarray of AdImageActionResultResults of adding images.
AdImageActionResult structure
AdImageHashstring

Hash of the image. Returned if there aren't any errors. See the section Operations on object arrays.

Warningsarray of ExceptionNotification

Warnings that occurred during the operation.

Errorsarray of ExceptionNotification

Errors that occurred during the operation.

Example

{
  "method": "add",
  "params": { 
    "AdImages": [{  
      "ImageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAA...", 
      "Name": "elephants.jpg" 
    }]
  }
}