targetingLogic
Target a banner using a logical expression.
Request format
https://adfox.yandex.com/api/v1
  ? object=banner
  & action=target
  & actionObject=targetingLogic
  & objectID=<integer>
  & isEnabled=<integer>
  & isRedefined=<integer>
  & [blocks=<json>]
| 
 | ID of the object that the action is performed on. | 
| 
 | Enable logical targeting. Acceptable values: 
 | 
| 
 | Redefine targeting. Acceptable values: 
 | 
| 
 | A representation of a logical expression in the form of an n-dimensional tree mapped to a non-recursive (ID links instead of a full description of child nodes) JSON structure of the following type is used: As you can see, the structure provides for versioning, and the sample representation reflects version 1. Further changes/extensions are to be included in subsequent versions. Every node of the first version has four fields: 
 | 
* Required
Response format
<response>
<status>
  <code>{integer}</code>
</status>
</response>
Response parameters
| 
 | Request processing status. For the key, see Error handling. | 
Sample request and response
Request:
https://adfox.yandex.com/api/v1?object=banner&action=target&actionObject=targetingLogic&objectID=474205&isEnabled=1&isRedefined&blocks={"version":1,"nodes":[{"id":1,"type":1,"value":{"subnodes":[2,3]}},{"id":2,"type":3,"value":{"key":2,"values":[6382, 6399]},"invert":true},{"id":3,"type":3,"value":{"key":6,"values":[136699]}}]}Response:
<response> <status> <code>0</code> </status> </response>
Other actions with the object
See more actions with the banner object:
- Get a list of banners.
- Add a banner.
- Edit a banner.
- Get summary information on targeting at the banner level.
- Get information on banner placement.
- Get statistics on campaigns/banners/placements for the day.
- Target a banner by frequency.
- Target a banner by geography.
- Target a banner by keywords.
- Target a banner by URL.
- Target a banner by gender, age, or income.
- Target a banner by user characteristics.
- Target a banner by time.
A representation of a logical expression in the form of an n-dimensional tree mapped to a non-recursive (ID links instead of a full description of child nodes) JSON structure of the following type is used:
{"version": 1,"nodes": [{"id": 1,"type": 2, "value": { "subnodes": [2, 5, 6] }}, {"id": 2,"type": 1, "value": { "subnodes": [3, 4] }}, {"id": 3,"type": 3, "value": { "key": 1, "values": [6, 7, 8] }}, {"id": 4,"type": 3, "value": { "key": 1, "values": [4, 5] }}, {"id": 5,"type": 3, "value": { "key": 2, "values": [1] }}, {"id": 6,"type": 3,"invert": true, "value": { "key": 2, "values": [2] }}]}{"version": 1,"nodes": [{"id": 1,"type": 2, "value": { "subnodes": [2, 5, 6] }}, {"id": 2,"type": 1, "value": { "subnodes": [3, 4] }}, {"id": 3,"type": 3, "value": { "key": 1, "values": [6, 7, 8] }}, {"id": 4,"type": 3, "value": { "key": 1, "values": [4, 5] }}, {"id": 5,"type": 3, "value": { "key": 2, "values": [1] }}, {"id": 6,"type": 3,"invert": true, "value": { "key": 2, "values": [2] }}]}
    
As you can see, the structure provides for versioning, and the sample representation reflects version 1. Further changes/extensions are to be included in subsequent versions.
Every node of the first version has four fields:
- 
id: A unique identifier of a node within a tree.The numbering always starts with 1, and the node with ID 1 is always the root. 
- 
invert: An inversion flag.The method for setting the notlogic. It's applied to the result of calculating the entire node. If there are child nodes, all of them are calculated first.
- 
type: The node content type ID.- 
1: The grouping AND node.
- 
2: The grouping OR node.
- 
3: The node for checking user fields (PUIDs).
 Nodes of the logic_andandlogic_ortypes actually implement brackets in which all child nodes are combined by the operation.
- 
- 
value: A JSON representation of the node content as a key and its values.- 
key: The user characteristic ID.
- 
values: An array of user characteristic value IDs.
 For example, characteristic №1 with the following values: a (valueID=10), b (valueID=20), and c (valueID=30).{"key": 1, "values": [10,20,30]}See also: 
- 
Required
ID of the object that the action is performed on.
Enable logical targeting.
Acceptable values:
- 
0: Disabled. Theblocksparameter is optional.
- 
1: Enabled. Theblocksparameter is required.
Redefine targeting.
Acceptable values:
- 
0: Inherit targeting settings from a higher level. Level hierarchy from top to bottom:- Campaign.
- Campaign on the site.
- Campaign in the site section.
- Campaign on the placement.
- Banner.
 
- 
1: Cancel targeting settings at higher levels and use the settings of the current level.