Sample requests
Let's say your account is already set up, and you need to start delivering ads.
Add a campaign
First, you need to add a campaign:
-
Add a host request block to the API request:
https://adfox.yandex.com/api/v1?
-
Go to the API documentation and find a description of the method for adding a campaign. To do this:
-
Find the context for adding an object. Adding a new object only applies to the
account
context. -
Find the action to add a campaign:
add
. -
Find the object to add:
campaign
.
The result is this path to the page: API version → account → add → campaign.
-
-
Add a navigation block to the request string to add a campaign:
object=account&action=add&actionObject=campaign
-
Next, add the required parameters and fill them in. If necessary, add optional method parameters.
-
The resulting API request to add a campaign looks like this:
https://adfox.yandex.com/api/v1?object=account&action=add&actionObject=campaign&name=April_16_tea&advertiserID=456&dateStart=2021-12-20 06:30&dateEnd=2021-12-31 22:30
If the campaign is successfully created, the new campaign ID is returned in the response.
Campaign placement on the site
After you add a campaign, you need to enable campaign placement on the site where you want to run your ads.
-
Add a host request block, a login block, and a navigation block to the API request:
https://adfox.yandex.com/api/v1?object=campaign&action=placing&actionObject=website
Here, the context is the campaign (
campaign
), the action is the placement (placing
), and the object of the action is the site (website
). -
To place a campaign on a site, you need to know the site ID.
If you don't know it, get a list of websites created in the context of the account:
https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=website
You'll receive a list of sites in this account in response to your request.
-
Specify the required method parameters in the request. If necessary, specify the optional parameters.
-
The resulting request to place the campaign on the site:
https://adfox.yandex.com/api/v1?object=campaign&action=placing&actionObject=website&objectID=474205&actionStatus=1&actionObjectID=3245
Add a banner to a campaign
Now let's add a banner to the campaign created in the previous step:
-
Add a host request block, a login block, and a navigation block to the API request:
https://adfox.yandex.com/api/v1?object=account&action=add&actionObject=banner
-
In the document, find the required parameters and, if necessary, the optional parameters for setting up banner delivery.
-
The resulting request to add a banner is as follows:
https://adfox.yandex.com/api/v1?object=account&action=add&actionObject=banner&name=aptil2022&campaignID=444444