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
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 | Action: Set. | Yes |
AdImageAssociations | Array of AdImageAssociation objects (no more than 10,000). Each object contains an association between an image and an ad. | Yes |
AdImageAssociation object | ||
AdID | The ad ID. | Yes |
AdImageHash | Hash of the image. If the parameter is omitted or NULL, the association between the image and ad is removed. | No |
Parameter | Description | Required |
AdImageAssociationRequest object | ||
---|---|---|
Action | Action: Set. | Yes |
AdImageAssociations | Array of AdImageAssociation objects (no more than 10,000). Each object contains an association between an image and an ad. | Yes |
AdImageAssociation object | ||
AdID | The ad ID. | Yes |
AdImageHash | Hash of the image. If the parameter is omitted or NULL, the association between the image and ad is removed. | No |
Output data
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 | |
---|---|
ActionsResult | Array of AdImageAssociationActionResult objects. Each object corresponds to an item in the AdImageAssociations input array and contains:
The items in the array are in the same order as the objects in the AdImageAssociations input array. |
AdImageAssociationActionResult object | |
AdID | The ad ID. |
Errors | Array of Error objects with errors that occurred while adding/removing associations. |
Error object | |
FaultCode | Error code. |
FaultString | Textual message about the error. |
FaultDetail | Detailed description of the reason for the error. |
Parameter | Description |
AdImageAssociationResponse object | |
---|---|
ActionsResult | Array of AdImageAssociationActionResult objects. Each object corresponds to an item in the AdImageAssociations input array and contains:
The items in the array are in the same order as the objects in the AdImageAssociations input array. |
AdImageAssociationActionResult object | |
AdID | The ad ID. |
Errors | Array of Error objects with errors that occurred while adding/removing associations. |
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': '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
}
]
}> > > > >