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 */
      "Type" : ("REGULAR" | "WIDE" | "FIXED_IMAGE" | "AUTO" ),
      "Name": (string) /* required */
    }, ... ] /* required */
  }
}
Parameter Type Description Required
Params structure (for JSON) / AddRequest structure (for SOAP)
AdImages array of AdImageAddItem Images to add (maximum of 100). Yes
AdImageAddItem structure
ImageData base64Binary

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
Type AdImageAddTypeEnum

Type of image. See here.

The type is determined automatically if the Type value is not set or the AUTO value is specified.

If an image fits two types, such as FIXED_IMAGE and REGULAR/WIDE, the REGULAR/WIDE type is selected.

No
Name string Caption for the image. Maximum of 255 characters. Yes
Parameter Type Description Required
Params structure (for JSON) / AddRequest structure (for SOAP)
AdImages array of AdImageAddItem Images to add (maximum of 100). Yes
AdImageAddItem structure
ImageData base64Binary

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
Type AdImageAddTypeEnum

Type of image. See here.

The type is determined automatically if the Type value is not set or the AUTO value is specified.

If an image fits two types, such as FIXED_IMAGE and REGULAR/WIDE, the REGULAR/WIDE type is selected.

No
Name string Caption 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)
      }, ... ]
    }, ... ]
  }
}
Parameter Type Description
Result structure (for JSON) / AddResponse structure (for SOAP)
AddResults array of AdImageActionResult Results of adding images.
AdImageActionResult structure
AdImageHash string

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

Warnings array of ExceptionNotification

Warnings that occurred during the operation.

Errors array of ExceptionNotification

Errors that occurred during the operation.

Parameter Type Description
Result structure (for JSON) / AddResponse structure (for SOAP)
AddResults array of AdImageActionResult Results of adding images.
AdImageActionResult structure
AdImageHash string

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

Warnings array of ExceptionNotification

Warnings that occurred during the operation.

Errors array of ExceptionNotification

Errors that occurred during the operation.

Example

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