Set
Adds/removes an association between an image and an ad.
To remove an association (unbind an image from an ad), pass an AdImageAssociation structure in which the AdImageHash parameter is omitted or is set to NULL.
Only one image can be associated with an ad: when adding a new association, the old one is removed automatically (however, points are deducted only for adding it).
Restrictions
Alert
The method only supports text and image ads. To work with all types of ads, use the Ads service in version 5 of the API. More about ad types...
Input data
The input data structure in JSON is shown below.
{
"method": "AdImageAssociation",
"param": {
/* AdImageAssociationRequest */
"Action": (string),
"AdImageAssociations": [
{ /* AdImageAssociation */
"AdID": (long),
"AdImageHash": (string),
}
...
]
}
}
Parameters are described below.
Parameter |
Description |
Required |
AdImageAssociationRequest object |
||
|
Action: Set. |
Yes |
|
Array of |
Yes |
AdImageAssociation object |
||
|
The ad ID. |
Yes |
|
Hash of the image. If the parameter is omitted or NULL, the association between the image and ad is removed. |
No |
Output data
Alert
An error when adding/removing one of the associations does not cause the entire operation to be canceled, and does not affect the success of adding/removing the other associations.
The output data structure in JSON is shown below.
{
"data": {
/* AdImageAssociationResponse */
"ActionsResult": [
{ /* AdImageAssociationActionResult */
"AdID": (long),
"Errors": [
{ /* Error */
"FaultCode": (int),
"FaultString": (string),
"FaultDetail": (string)
}
...
]
}
...
],
}
}
Parameters are described below.
Parameter |
Description |
AdImageAssociationResponse object |
|
|
Array of
The items in the array are in the same order as the objects in the |
AdImageAssociationActionResult object |
|
|
The ad ID. |
|
Array of |
Error object |
|
|
Error code. |
|
Textual message about the error. |
|
Detailed description of the reason for the error. |
Examples of input data
Python
{
'Action': 'Set',
'AdImageAssociations': [
{
# Adding associations
'AdID': 2571700,
'AdImageHash': 'c6da811f75221196dd5b1a8ca703344b',
},
{
# Removing associations
'AdID': 2571745
},
]
}
PHP
array(
'Action' => 'Set',
'AdImageAssociations' => array(
array(
# Adding associations
'AdID' => 2571700,
'AdImageHash' ='c6da811f75221196dd5b1a8ca703344b'
),
array(
# Removing associations
'AdID' =2571745
)
)
)>
Perl
{
'Action' => 'Set',
'AdImageAssociations' => [
{
# Adding associations
'AdID' => 2571700,
'AdImageHash' ='c6da811f75221196dd5b1a8ca703344b'
},
{
# Removing associations
'AdID' =2571745
}
]
}>