Translations:API/1/en — различия между версиями

Материал из Справочник сервиса Kadam.net
Перейти к: навигация, поиск
(Новая страница: «== API authorization == To access the API, you will need a user ID (app_id) and a signature (signature). Calling different methods is carried out using queries o…»)
 
 
Строка 36: Строка 36:
 
</code>
 
</code>
 
'''Signature (signature)''' is created using a temporary token (access_token), which can be obtained using the app_id and secret key parameters.
 
'''Signature (signature)''' is created using a temporary token (access_token), which can be obtained using the app_id and secret key parameters.
<br> Parameters app_id (user ID) and the key "secret key" are available on request to support.
+
<br /> Parameters app_id (user ID) and the key "secret key" are available on request to support.
<br> Getting a token:
+
<br /> Getting a token:
 
<code>
 
<code>
 
<pre>
 
<pre>
Строка 103: Строка 103:
  
 
== Campaign Statistics ==
 
== Campaign Statistics ==
To get campaign statistics, use the method <b>ads.analytic.campaign.get</b><br/>
+
To get campaign statistics, use the method <b>ads.analytic.campaign.get</b><br />
 
<table>
 
<table>
 
   <tr bgcolor = #DCDCDC>
 
   <tr bgcolor = #DCDCDC>
Строка 146: Строка 146:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b>Result:</b><br/>
+
<b>Result:</b><br />
 
Returns an object with data
 
Returns an object with data
 
<code>
 
<code>
Строка 167: Строка 167:
 
== Statistics on sites in the advertiser's account ==
 
== Statistics on sites in the advertiser's account ==
 
Statistics on sites in the advertiser's account means statistics on views and clicks on the site in the context of each campaign.
 
Statistics on sites in the advertiser's account means statistics on views and clicks on the site in the context of each campaign.
<br>To get statistics on sites, use the <b> ads.campaigns.statblock.get </b> method (GET request)
+
<br />To get statistics on sites, use the <b> ads.campaigns.statblock.get </b> method (GET request)
 
<table>
 
<table>
 
   <tr bgcolor = #DCDCDC>
 
   <tr bgcolor = #DCDCDC>
Строка 260: Строка 260:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an object with data, example:
 
Returns an object with data, example:
 
<code>
 
<code>
Строка 349: Строка 349:
  
 
== Statistics on all campaign materials ==
 
== Statistics on all campaign materials ==
To get statistics on all campaign materials, use the <b> ads.analytic.materials.get </b> method <br/>
+
To get statistics on all campaign materials, use the <b> ads.analytic.materials.get </b> method <br />
  
 
<table>
 
<table>
Строка 388: Строка 388:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an object with data
 
Returns an object with data
 
<code>
 
<code>
Строка 410: Строка 410:
  
 
== Material statistics ==
 
== Material statistics ==
For statistics on the material, use the method <b> ads.analytic.material.get </b> <br/>
+
For statistics on the material, use the method <b> ads.analytic.material.get </b> <br />
 
<table>
 
<table>
 
   <tr bgcolor = #DCDCDC>
 
   <tr bgcolor = #DCDCDC>
Строка 448: Строка 448:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an object with data
 
Returns an object with data
 
<code>
 
<code>
Строка 469: Строка 469:
  
 
== Creating an advertising campaign ==
 
== Creating an advertising campaign ==
To create a new advertising campaign, use the <b> ads.campaigns.put </b> <br> method
+
To create a new advertising campaign, use the <b> ads.campaigns.put </b> <br /> method
The number of campaigns created with a single request is 50. <br/>
+
The number of campaigns created with a single request is 50. <br />
 
<table>
 
<table>
 
   <tr bgcolor = #DCDCDC>
 
   <tr bgcolor = #DCDCDC>
Строка 657: Строка 657:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the id of the created campaign, and the error_code and error_desc fields in case of an error.
 
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the id of the created campaign, and the error_code and error_desc fields in case of an error.
 
<p> Errors: </p>
 
<p> Errors: </p>
Строка 664: Строка 664:
  
 
== Editing ad campaigns ==
 
== Editing ad campaigns ==
To edit ad campaigns, use the <b> ads.campaigns.update </b> <br> method
+
To edit ad campaigns, use the <b> ads.campaigns.update </b> <br /> method
The maximum number of campaigns edited with a single query is 50. <br>
+
The maximum number of campaigns edited with a single query is 50. <br />
 
Version log: 1.0.1 - added status parameter
 
Version log: 1.0.1 - added status parameter
 
<table>
 
<table>
Строка 795: Строка 795:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.
 
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.
 
<p> Errors: </p>
 
<p> Errors: </p>
Строка 851: Строка 851:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of campaign objects, each of which contains the following fields:
 
Returns an array of campaign objects, each of which contains the following fields:
 
<code>
 
<code>
Строка 882: Строка 882:
  
 
== Archiving an advertising campaign ==
 
== Archiving an advertising campaign ==
To archive an advertising campaign, use the <b> ads.campaigns.delete </b> <br> method
+
To archive an advertising campaign, use the <b> ads.campaigns.delete </b> <br /> method
The maximum number of clients edited with a single query is 10. <br/>
+
The maximum number of clients edited with a single query is 10. <br />
  
 
<table>
 
<table>
Строка 900: Строка 900:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
 
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
 
<p> Errors: </p>
 
<p> Errors: </p>
Строка 908: Строка 908:
  
 
== Receiving codes for CPA campaigns ==
 
== Receiving codes for CPA campaigns ==
Use the <b> ads.campaigns.cpa.mode.get </b> <br/> method to get the codes for the CPA campaigns
+
Use the <b> ads.campaigns.cpa.mode.get </b> <br /> method to get the codes for the CPA campaigns
  
 
<table>
 
<table>
Строка 922: Строка 922:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an object with data.
 
Returns an object with data.
 
<code>
 
<code>
Строка 935: Строка 935:
  
 
== Getting a list of categories for a given filter ==
 
== Getting a list of categories for a given filter ==
To return the list of categories for a given filter, use the <b> ads.campaigns.categories.get </b> <br/> method
+
To return the list of categories for a given filter, use the <b> ads.campaigns.categories.get </b> <br /> method
  
 
<table>
 
<table>
Строка 956: Строка 956:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the response array.
 
Returns an array of responses to queries in the response array.
 
<code>
 
<code>
Строка 975: Строка 975:
  
 
== Getting the list of ad formats ==
 
== Getting the list of ad formats ==
Use the <b> ads.campaigns.formats.get </b> <br/> method to get the list of ad formats.
+
Use the <b> ads.campaigns.formats.get </b> <br /> method to get the list of ad formats.
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the response array.
 
Returns an array of responses to queries in the response array.
 
<code>
 
<code>
Строка 992: Строка 992:
  
 
== Getting the list of platforms ==
 
== Getting the list of platforms ==
For a list of platforms, use the <b> ads.targeting.platforms.get </b> <br/> method
+
For a list of platforms, use the <b> ads.targeting.platforms.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the response array.
 
Returns an array of responses to queries in the response array.
 
<code>
 
<code>
Строка 1010: Строка 1010:
  
 
== Getting Browser List ==
 
== Getting Browser List ==
For a list of browsers, use the <b> ads.targeting.browsers.get </b> <br/> method
+
For a list of browsers, use the <b> ads.targeting.browsers.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the response array.
 
Returns an array of responses to queries in the response array.
 
<code>
 
<code>
Строка 1027: Строка 1027:
  
 
== Getting a list of conversion notifications for the CPA ==
 
== Getting a list of conversion notifications for the CPA ==
To get a list of conversion notifications for CPA, use the <b> ads.targeting.cpa.modes.get </b> <br/> method
+
To get a list of conversion notifications for CPA, use the <b> ads.targeting.cpa.modes.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the response array.
 
Returns an array of responses to queries in the response array.
 
<code>
 
<code>
Строка 1044: Строка 1044:
  
 
== Getting a list of ages ==
 
== Getting a list of ages ==
To get the list of views, use the <b> ads.targeting.ages.get </b> <br/> method
+
To get the list of views, use the <b> ads.targeting.ages.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the response array.
 
Returns an array of responses to queries in the response array.
 
<code>
 
<code>
Строка 1061: Строка 1061:
  
 
== Creating advertising agency clients ==
 
== Creating advertising agency clients ==
To create ad agency clients, use the <b> ads.clients.put method </b> <br/>
+
To create ad agency clients, use the <b> ads.clients.put method </b> <br />
 
The allowable number of clients created with a single request is 50.
 
The allowable number of clients created with a single request is 50.
  
Строка 1090: Строка 1090:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the client information or the error array in case of an error (for each client separately).
 
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the client information or the error array in case of an error (for each client separately).
 
<code>
 
<code>
Строка 1103: Строка 1103:
  
 
== Editing advertising agency clients ==
 
== Editing advertising agency clients ==
To edit ad agency clients, use the <b> ads.clients.update method </b> <br/>
+
To edit ad agency clients, use the <b> ads.clients.update method </b> <br />
 
The maximum number of clients edited with a single query is 50.
 
The maximum number of clients edited with a single query is 50.
  
Строка 1137: Строка 1137:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.
 
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.
  
 
== Getting a list of advertising agency clients ==
 
== Getting a list of advertising agency clients ==
To return the list of clients of an advertising agency, use the <b> ads.clients.get method </b> <br/>
+
To return the list of clients of an advertising agency, use the <b> ads.clients.get method </b> <br />
  
 
<table>
 
<table>
Строка 1157: Строка 1157:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of client objects of the agency, each of which contains the following fields:
 
Returns an array of client objects of the agency, each of which contains the following fields:
 
<code>
 
<code>
Строка 1174: Строка 1174:
  
 
== Archiving advertising agency clients ==
 
== Archiving advertising agency clients ==
For archiving ad agency clients, use the <b> ads.clients.delete method </b> <br/>
+
For archiving ad agency clients, use the <b> ads.clients.delete method </b> <br />
  
 
<table>
 
<table>
Строка 1192: Строка 1192:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
 
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
  
 
== Tying a client to an advertising agency ==
 
== Tying a client to an advertising agency ==
To bind a client to an advertising agency, use the <b> ads.clients.bind.put method </b> <br/>
+
To bind a client to an advertising agency, use the <b> ads.clients.bind.put method </b> <br />
  
 
<table>
 
<table>
Строка 1216: Строка 1216:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns:
 
Returns:
 
<code>
 
<code>
Строка 1228: Строка 1228:
  
 
== Detaching a client from an advertising agency ==
 
== Detaching a client from an advertising agency ==
To detach a client from an advertising agency, use the <b> ads.clients.unbind.put method </b> <br/>
+
To detach a client from an advertising agency, use the <b> ads.clients.unbind.put method </b> <br />
  
 
<table>
 
<table>
Строка 1243: Строка 1243:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns:
 
Returns:
 
<code>
 
<code>
Строка 1255: Строка 1255:
  
 
== Customer account replenishment ==
 
== Customer account replenishment ==
To replenish the client’s account, use the <b> ads.clients.balance.put method </b> <br/>
+
To replenish the client’s account, use the <b> ads.clients.balance.put method </b> <br />
  
 
<table>
 
<table>
Строка 1287: Строка 1287:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns the url for payment:
 
Returns the url for payment:
 
<code>
 
<code>
Строка 1301: Строка 1301:
  
 
== Creating advertisements ==
 
== Creating advertisements ==
To create ads using the method <b> ads.materials.put </b> <br/>
+
To create ads using the method <b> ads.materials.put </b> <br />
 
The maximum allowable number of ads generated by a single request is 20.
 
The maximum allowable number of ads generated by a single request is 20.
  
Строка 1363: Строка 1363:
  
 
== Update ad data ==
 
== Update ad data ==
Use the <b> ads.materials.update </b> <br/> method to update ad data.
+
Use the <b> ads.materials.update </b> <br /> method to update ad data.
 
The maximum allowable number of ads generated by a single request is 20.
 
The maximum allowable number of ads generated by a single request is 20.
  
Строка 1396: Строка 1396:
  
 
== Archiving advertisements ==
 
== Archiving advertisements ==
For advertising ads using the method <b> ads.materials.delete </b> <br/>
+
For advertising ads using the method <b> ads.materials.delete </b> <br />
 
The maximum number of clients edited with a single query is 50.
 
The maximum number of clients edited with a single query is 50.
  
Строка 1417: Строка 1417:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
 
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
  
Строка 1478: Строка 1478:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of ad objects, each of which contains the following fields:
 
Returns an array of ad objects, each of which contains the following fields:
 
  <ul type = "disc">
 
  <ul type = "disc">
Строка 1507: Строка 1507:
  
 
== Getting a list of banner sizes ==
 
== Getting a list of banner sizes ==
For a list of banner sizes, use the <b> ads.materials.banner.sizes.get </b> <br/> method
+
For a list of banner sizes, use the <b> ads.materials.banner.sizes.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to requests in the response array:
 
Returns an array of responses to requests in the response array:
 
<code>
 
<code>
Строка 1524: Строка 1524:
  
 
== Getting the list of countries ==
 
== Getting the list of countries ==
To get the list of countries, use the <b> data.geo.countries.get </b> <br/> method
+
To get the list of countries, use the <b> data.geo.countries.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to requests in the response array:
 
Returns an array of responses to requests in the response array:
 
<code>
 
<code>
Строка 1541: Строка 1541:
  
 
== Getting a list of regions for a given filter ==
 
== Getting a list of regions for a given filter ==
To get a list of regions for a given filter, use the <b> data.geo.regions.get </b> <br/> method
+
To get a list of regions for a given filter, use the <b> data.geo.regions.get </b> <br /> method
  
 
<table>
 
<table>
Строка 1556: Строка 1556:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to requests in the response array:
 
Returns an array of responses to requests in the response array:
 
<code>
 
<code>
Строка 1571: Строка 1571:
  
 
== Get a list of available payment systems ==
 
== Get a list of available payment systems ==
To get a list of available payment systems, use the <b> data.balance.systems.get </b> <br/> method
+
To get a list of available payment systems, use the <b> data.balance.systems.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to requests in the response array:
 
Returns an array of responses to requests in the response array:
 
<code>
 
<code>
Строка 1588: Строка 1588:
  
 
== Download media files ==
 
== Download media files ==
To upload media files (jpg, png, gif), use the <b> data.upload.media.update </b> <br/> method
+
To upload media files (jpg, png, gif), use the <b> data.upload.media.update </b> <br /> method
  
 
<table>
 
<table>
Строка 1607: Строка 1607:
 
</table>
 
</table>
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array with a reference to the target object or error in case of an error.
 
Returns an array with a reference to the target object or error in case of an error.
 
<code>
 
<code>
Строка 1665: Строка 1665:
  
 
== Get the current server time ==
 
== Get the current server time ==
To get the current server time in ISO 8601 format, use the <b> server.time.get </b> <br/> method
+
To get the current server time in ISO 8601 format, use the <b> server.time.get </b> <br /> method
  
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
Returns an array of responses to requests in the response array:
 
Returns an array of responses to requests in the response array:
 
<code>
 
<code>
Строка 1678: Строка 1678:
  
 
== Statistics for Webmasters ==
 
== Statistics for Webmasters ==
For statistics on webmasters use the method <b> webmaster.reports.report.get </b> <br/>
+
For statistics on webmasters use the method <b> webmaster.reports.report.get </b> <br />
  
 
<table>
 
<table>
Строка 1702: Строка 1702:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> Maximum unloading period 1 month </b> <br/>
+
<b> Maximum unloading period 1 month </b> <br />
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
  <ul type = "disc">
 
  <ul type = "disc">
 
       <li> <b> blockviews </b> - Block Views </li>
 
       <li> <b> blockviews </b> - Block Views </li>
Строка 1728: Строка 1728:
  
 
== Money transfer for subsidiary accounts of the agency ==
 
== Money transfer for subsidiary accounts of the agency ==
To transfer money, use the <b> ads.clients.balance.update method </b> <br/>
+
To transfer money, use the <b> ads.clients.balance.update method </b> <br />
  
 
<table>
 
<table>
Строка 1757: Строка 1757:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
<b> The operation can be performed only if there are sufficient funds on the account </b> <br/>
+
<b> The operation can be performed only if there are sufficient funds on the account </b> <br />
<b> Money will be withdrawn from the user specified in the app_id </b> <br/>
+
<b> Money will be withdrawn from the user specified in the app_id </b> <br />
<b> Result: </b> <br/>
+
<b> Result: </b> <br />
 
The result of the operation will be the withdrawal of funds from the primary user - an output transaction. And the transfer of money to the agency account is an input transaction.
 
The result of the operation will be the withdrawal of funds from the primary user - an output transaction. And the transfer of money to the agency account is an input transaction.
  

Текущая версия на 14:47, 11 февраля 2019

Информация о сообщении (править)
Это сообщение не имеет описания. Если вы знаете, где или как это сообщение используется, то можете помочь другим переводчикам, добавив к нему описание.
Формулировка сообщения (API)
==API авторизация==
Для доступа в API понадобятся ID пользователя (app_id) и подпись (signature).
Вызов разных методов осуществляется при помощи запросов по данному шаблону:
<code>
<pre>
       api.kadam.net?%action%.%method%?%params%
</pre>
<pre>
       %action% - к чему обращаемся
       %method% - тип обращения
    get - получить 
    put - записать 
    post - обновить
    delete - удалить
       %params% - параметры запроса
       обязательные параметры %params%
       app_id - id пользователя
       signature - подпись
</pre>
</code>
Пример:
<code>
<pre>
       [GET] http://api.kadam.net/campaigns.get?app_id=%app_id%&signature=%signature%
</pre>
</code>
или
<code>
<pre>
       [GET] http://api.kadam.net/campaigns?app_id=%app_id%&signature=%signature%
       [GET] - метод обращения по http
</pre>
</code>
'''Подпись (signature)''' создается с помощью временного токена (access_token), который можно получить используя параметры app_id и secret key.
<br>Параметры app_id (ID пользователя) и ключ "secret key" можно получить по запросу в поддержку.
<br>Получение токена:
<code>
<pre>
       [GET] http://api.kadam.net/auth.token?app_id=%app_id%&secret_key=%key%
       -> {“access_token”: “...”}
</pre>
</code>
Формирование signature для метода [GET]:
<code>
<pre>
       md5 ( %sort_params% . %access_token% )
       %sort_params% - все передаваемые параметры (кроме signature) сортируются по имени
</pre>
</code>
Пример:
<code>
<pre>
       app_id=1&campaign_id=3…
       [PUT] http://api.kadam.net/campaigns?signature=%signature%
       +post fields -> %params%
</pre>
</code>
Пример для php. Получение списка кампаний:
<code>
<pre>
       <?
       $your_secret_key = "jqhwekq8734quo37o498q3p498qp34";
       $your_app_id = 1;
       $auth_url = "http://api.kadam.net/auth.token?app_id={$your_app_id}&secret_key={$your_secret_key}";
       $auth = file_get_contents($auth_url);
       $auth = json_decode($auth, true);
       if ( !is_array( $auth ) || !isset( $auth['access_token'] ) ) {
           die( 'something wrong! ' . print_r( $res, true ) );
       }
       $token    = $auth['access_token'];
       $params = array(
    'client_id' => $your_app_id,
       'app_id' => $your_app_id,
       );
       ksort( $params );
       $result = array ();
       foreach( $params as $key => $value ) {
           $result[] = $key . '=' . urlencode( $value );
       }
       $params = implode( '&', $result );
       $signature = md5( $params . $token );
       $campaign_url = 'http://api.kadam.net/ads.campaigns.get?' . $params . '&signature=' . $signature;
       $campaigns = file_get_contents($campaign_url);
       $campaigns = json_decode($campaigns, true);
       if ( !is_array( $campaigns ) || !isset( $campaigns['response'] ) ) {
           die( 'something wrong! ' . print_r( $campaigns, true ) );
       }
       print_r($campaigns);
</pre>
</code>
==Статистика по кампании==
Для получения статистики по кампании используется метод <b>ads.analytic.campaign.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>id кампании</td>
       <td>int (числовое значение), обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>region_id</td>
       <td>id региона: data.geo.regions.get</td>
       <td>int (числовое значение), необязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>period</td>
       <td>Способ группировки данных по датам: 
           <p>day — статистика по дням;</p>
           <p>month - статистика по месяцам</p>
           <p>Временные ограничения задаются параметрами date_from и date_to</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_from</td>
       <td>Начальная дата выводимой статистики. Используется разный формат дат для разного значения параметра period: 
           <p>day: YYYY-MM-DD, пример: 2011-09-27;</p>
           <p>month: YYYY-MM, пример: 2011-09</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_to</td>
       <td>Конечная дата выводимой статистики. Используется разный формат дат для разного значения параметра period: 
           <p>day: YYYY-MM-DD, пример: 2011-09-27;</p>
           <p>month: YYYY-MM, пример: 2011-09</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает объект с данными
<code>
<pre>
{
response: {
count: %total items%
items: {
shows
clicks
ctr
cpm
money
                       }
                 }
}
</pre>
</code>
==Статистика по площадкам в кабинете рекламодателя==
Под статистикой по площадкам в кабинете рекламодателя подразумевается статистика по показам и кликам на площадке в разрезе каждой кампании.
<br>Для получения статистики по площадкам используется метод <b>ads.campaigns.statblock.get</b> (GET запрос)
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_from</td>
       <td>Начальная дата выводимой статистики.</td>
       <td>строка, формат YYYY-MM-DD (пример: 2017-05-15), параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_to</td>
       <td>Конечная дата выводимой статистики.</td>
       <td>строка, формат YYYY-MM-DD (пример: 2017-05-15), параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>id кампании</td>
       <td>обязательный параметр, int (числовое значение), параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>signature</td>
       <td>Подпись (генерируется с помощью временного токена, см. выше)</td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>app_id</td>
       <td>id пользователя</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>macros</td>
       <td>id площадки</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>leads</td>
       <td>Лиды</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>views</td>
       <td>Показы</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>clicks</td>
       <td>Клики</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>conversions</td>
       <td>Подтвердженные конверсии</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>rejections</td>
       <td>Отказанные конверсии</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ctr</td>
       <td>CTR</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>cpm</td>
       <td>CPM</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>cpc</td>
       <td>CPC</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>prelandvisit</td>
       <td>Визиты преленда</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>prelanduseful</td>
       <td>Полезные визиты преленда</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>prelandscroll</td>
       <td>Скролл преленда</td>
       <td>int (числовое значение), параметр сотировки, параметр фильтрации</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает объект с данными, пример:
<code>
<pre>
{
  "response": {
   "count": 1,
   "items": [
     {
       "macros": "12345678901234",
       "block": "1234",
       "domain": "123456789",
       "leads": "0",
       "views": "123",
       "clicks": "0",
       "conversions": "0",
       "rejections": "0",
       "ctr": "0.0000",
       "cpm": "0.00",
       "cpc": null,
       "moneyOut": "0.000000",
       "moneyIn": null,
       "prelandvisit": "0",
       "prelanduseful": "0",
       "prelandscroll": "0",
       "landvisit": "0",
       "landuseful": "0",
       "landscroll": "0",
       "multiplier": null,
       "blackList": "0"
     }
   ],
   "request": {
     "campaignId": 123456,
     "limit": 10,
     "offset": 0
   }
  }
}
</pre>
</code>
'''Сортировка'''
Сортировка по возрастанию
<code><pre>
sort={параметр}
Пример: api.kadam.net?sort=views
</pre></code>
Сортировка по убыванию
<code><pre>
sort=-{параметр}
Пример: api.kadam.net?sort=-views
</pre></code>
Сортировка по нескольким параметрам
<code><pre>
sort={параметр1},-{параметр2},{параметр3}
Пример: api.kadam.net?sort=views,-clicks,leads
</pre></code>
'''Фильтрация'''
<code><pre>
{параметр}={значение}
Примеры:
api.kadam.net?attr=10
api.kadam.net?attr=string
api.kadam.net?attr=string&date_from=01.05.2016&date_to=01.07.2016
</pre></code>
==Изменение множителя для статистики по площадкам в кабинете рекламодателя==
Для изменения множителя для статистики по площадкам используется метод <b>ads.campaigns.statblock</b> (PUT запрос)
Параметры (все являются обязательными):
<ul>
<li>app_id - id пользователя, числовое значение (int)</li>
<li>signature - подпись, строка (string)</li>
<li>campaign_id - id кампании, числовое значение (int)</li>
<li>block - числовое значение (int)</li>
<li>domain - числовое значение (int)</li>
<li>multiplier - новое значение множителя, числовое значение (float)</li>
<li>multiplierOld - старое значение множителя, числовое значение (float)</li>
<li>macros - id площадки, числовое значение (int)</li>
</ul>
Параметры block и macros в кабинете не выводятся, их можно получить через метод, описанный в пункте "Статистика по площадкам в кабинете рекламодателя".
==Статистика по всем материалам кампании==
Для получения статистики по всем материалам кампании используется метод <b>ads.analytic.materials.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>id кампании</td>
       <td>int (числовое значение), обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>period</td>
       <td>Способ группировки данных по датам: 
           <p>1. day — статистика по дням;</p>
           <p>2. month — статистика по месяцам;</p>
           <p>Временные ограничения задаются параметрами date_from и date_to</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_from</td>
       <td>Начальная дата выводимой статистики. Используется разный формат дат для разного значения параметра period: 
           <p>1. day: YYYY-MM-DD, пример: 2011-09-27</p>
           <p>2. month: YYYY-MM, пример: 2011-09</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_to</td>
       <td>Конечная дата выводимой статистики. Используется разный формат дат для разного значения параметра period: 
           <p>1. day: YYYY-MM-DD, пример: 2011-09-27</p>
           <p>2. month: YYYY-MM, пример: 2011-09</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает объект с данными
<code>
<pre>
{
response: {
count: %total items%
items: {
teaser_id
date
shows
clicks
ctr
cpm
money
                       }
                 }
}
</pre>
</code>
==Статистика по материалу==
Для получения статистики по материалу используется метод <b>ads.analytic.material.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>material_id</td>
       <td>id материала</td>
       <td>int (числовое значение), обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>period</td>
       <td>Способ группировки данных по датам: 
           <p>1. day — статистика по дням;</p>
           <p>2. month — статистика по месяцам;</p>
           <p>Временные ограничения задаются параметрами date_from и date_to</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_from</td>
       <td>Начальная дата выводимой статистики. Используется разный формат дат для разного значения параметра period: 
           <p>1. day: YYYY-MM-DD, пример: 2011-09-27</p>
           <p>2. month: YYYY-MM, пример: 2011-09</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_to</td>
       <td>Конечная дата выводимой статистики. Используется разный формат дат для разного значения параметра period: 
           <p>1. day: YYYY-MM-DD, пример: 2011-09-27</p>
           <p>2. month: YYYY-MM, пример: 2011-09</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает объект с данными
<code>
<pre>
{
response: {
count: %total items%
items: {
date
shows
clicks
ctr
cpm
money
                       }
                 }
}
</pre>
</code>
==Создание рекламной кампании==
Для для создания новой рекламной кампании используется метод <b>ads.campaigns.put</b><br>
Допустимое количество кампаний, создаваемых с помощью одного запроса — 50.<br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>data</td>
       <td>сериализованный JSON-массив объектов, описывающих создаваемые кампании. Описание объектов client_specification см. ниже.</td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_specification</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>app_id</td>
       <td>id пользователя</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>id клиента, в рекламном кабинете которого будет создаваться кампания. Так же может принимать значение app_id (самого себя)
       </td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ad_format</td>
       <td>Формат объявления: 
           <p>10 - Тизерная;</p>
           <p>20 - Баннерная;</p>
           <p>30 - Push-уведомления;</p>
           <p>40 - Clickunder;</p>
           <p>60 - Контекстная</p>
       </td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>cost_type</td>
       <td>Способ оплаты: 
           <p>0 - СРС;</p>
           <p>1 - СРА;</p>
           <p>2 - СРМ</p>
       </td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>name</td>
       <td>название кампании 
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>Link_url</td>
       <td>ссылка на рекламируемый объект в формате: http://yoursite.cоm 
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>real_url</td>
       <td>ссылка на реальный домен рекламируемого объекта в формате: http://yoursite.cоm 
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>sex</td>
       <td>Пол: 
           <p>3 - любой;</p>
           <p>2 - мужской;</p>
           <p>1 - женский</p>
       </td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>age</td>
       <td>Возраст целевой аудитории. Номер возрастной категории от 1 до 6 (до 17, 18-25, 26-34, 35-49, 50-60, старше 61)</td> 
       <td>обязательный параметр, последовательность чисел, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>regions</td>
       <td>Регионы, от 1 до 10 (1 - Россия, 2 - Украина и т.д.)</td> 
       <td>обязательный параметр, последовательность чисел, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>cpa_mode</td>
       <td>Тип уведомлений о конверсий для CPA: /ads.targeting.modes.get</td> 
       <td>int (числовое значение), обязательное для CPA кампании</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>categories</td>
       <td><p>идентификаторы категорий:</p>
           <p>/data.categories.get?ad_format=%</p>
       </td>
       <td><p>масив [category_id => cost]</p></td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>tags</td>
       <td>таргетинг по ключевым словам</td> 
       <td><p>обязательный параметр, последовательность ключевых слов, разделенных запятой: [“key1”, “key2”, .., “keyN”]</p>
           <p>Ключевые слова с ценой. Только для оплаты - за клики или за показы: {“key1”: “cost”, “key2”: “cost”, .., “keyN”: “cost”}</p>
           <p>cost - float</p>
           <p>пример: "data[tags][qwerty]: 1" - ключевое слово qwerty со ставкой 1руб.</p>
       </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>day_limit</td>
       <td>Дневной лимит в рублях. Для всех типов кроме clickunder</td> 
       <td>положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>all_limit</td>
       <td>Общий лимит в рублях. Для всех типов кроме clickunder</td> 
       <td>положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>click_limit</td>
       <td>Максимальное кол. переходов в день. Для всех типов кроме clickunder. За показы и за клики.</td> 
       <td>положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>conversion_limit</td>
       <td>Максимальное кол. конверсий в день. Для всех типов кроме clickunder. Только для CPA</td> 
       <td>положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>adult_content</td>
       <td>присутсвие контента для взрослых в рекламной кампании: 
           <p>0 - Нет;</p>
           <p>1 - Да</p>
       </td>
       <td>необязательный параметр, int (числовое значение), по умолчанию 0</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>adult_site</td>
       <td>Отображать объявления кампании на сайтах с контентом для взрослых: 
           <p>0 - Нет;</p>
           <p>1 - Да</p>
       </td>
       <td>необязательный параметр, int (числовое значение), по умолчанию 0</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>time_show</td>
       <td>Временной таргетинг: 
           <p>&nbsp;&nbsp; * - отображение в любые часы и дни недели</p>
           <p>&nbsp;&nbsp; {} - массив, где ключ имя дня недели ["Sn","Mn","Tu","Wd","Th","Fr","Sa"]:</p>
           <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {} - ‘mn’: ‘*’ - все часы понендельника</p>
           <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {} - ‘mn’: [0, .., 23] - часы через запятую</p>
       </td>
       <td>необязательный параметр, * по умолчанию</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>platforms</td>
       <td>таргетинг по платформам:  /data.platforms</td> 
       <td>последовательность чисел, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>browsers</td>
       <td>таргетинг по браузерам:  /data.browsers</td> 
       <td>последовательность чисел, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>black_list</td>
       <td>черный список площадок на которых не будет показана реклама</td> 
       <td>последовательность чисел ID площадок, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>white_list</td>
       <td>белый список площадок на которых не будет показана реклама</td> 
       <td>последовательность чисел ID площадок, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>black_list_ip</td>
       <td>блокировка по ip</td> 
       <td>последовательность ip адресов, разделенных запятой или массивом</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>unique_day_count</td>
       <td>частота показов материала одному пользователю (разы)</td> 
       <td>положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>unique_days</td>
       <td>частота показов рекламного материала одному пользователю (дни)</td> 
       <td>положительное число</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве data. Соответствующий объект в выходном массиве содержит id созданной кампании, и поля error_code и error_desc в случае возникновения ошибки.
<p>Errors:</p>
<pre>  102 - unknown client
   103 - overlimit campaigns</pre>
==Редактирование рекламных кампаний==
Для редактирования рекламных кампаний используется метод <b>ads.campaigns.update</b><br>
Максимальное допустимое количество кампаний, редактируемых с помощью одного запроса — 50.<br>
Version log: 1.0.1 - добавлен параметр status
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>data</td>
       <td>сериализованный JSON-массив объектов, описывающих изменения в кампаниях. Описание объектов client_mod_specification см. ниже.</td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_specification</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>id редактируемой кампании
       </td>
       <td>обязательный параметр, положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>name</td>
       <td>название кампании</td>
       <td>необязательный параметр, строка длиной от 3 до 60 символов</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>link_url</td>
       <td>ссылка на рекламируемый объект в формате http://yoursite.cоm</td>
       <td>необязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>real_url</td>
       <td>ссылка на реальный домен рекламируемого объекта в формате: http://yoursite.cоm 
       </td>
       <td>необязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>sex</td>
       <td>Пол: 
           <p>3 - любой;</p>
           <p>2 - мужской;</p>
           <p>1 - женский</p>
       </td>
       <td>необязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>age</td>
       <td>возраст: /data.ages</td>
       <td>необязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>categories</td>
       <td>идентификаторы категорий:
           <p>/data.categories.get?ad_format=%</p>
           <p>category_id: {region_id: cost}</p>
       </td>
       <td>необязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>tags</td>
       <td>таргетинг по ключевым словам</td>
       <td>необязательный параметр, последовательность ключевых слов, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>day_limit</td>
       <td>дневной лимит в рублях. для всех типов кроме clickunder</td>
       <td>необязательный параметр, положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>adult_content</td>
       <td>присутсвие контента для взрослых в рекламной кампании: 
           <p>0 - Нет;</p>
           <p>1 - Да</p>
       </td>
       <td>необязательный параметр, int (числовое значение), по умолчанию 0</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>adult_site</td>
       <td>отображать объявления кампании на сайтах с контентом для взрослых: 
           <p>0 - Нет;</p>
           <p>1 - Да</p>
       </td>
       <td>необязательный параметр, int (числовое значение), по умолчанию 0</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>time_show</td>
       <td>Временной таргетинг: 
           <p>&nbsp;&nbsp; * - отображение в любые часы и дни недели</p>
           <p>&nbsp;&nbsp; {} - массив, где ключ имя дня недели ["Sn","Mn","Tu","Wd","Th","Fr","Sa"]:</p>
           <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {} - ‘mn’: ‘*’ - все часы понендельника</p>
           <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {} - ‘mn’: [0, .., 23] - часы через запятую</p>
       </td>
       <td>необязательный параметр, * по умолчанию</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>platforms</td>
       <td>таргетинг по платформам:  /data.platforms</td> 
       <td>последовательность чисел, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>browsers</td>
       <td>таргетинг по браузерам:  /data.browsers</td> 
       <td>последовательность чисел, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>black_list</td>
       <td>черный список площадок на которых не будет показана реклама</td> 
       <td>последовательность чисел ID площадок, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>white_list</td>
       <td>белый список площадок на которых не будет показана реклама</td> 
       <td>последовательность чисел ID площадок, разделенных запятой</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>black_list_ip</td>
       <td>блокировка по ip</td> 
       <td>последовательность ip адресов, разделенных запятой или массивом</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>status</td>
       <td>запуск/приостановка кампании: 
           <p>0 - приостановлена;</p>
           <p>1 - запущена</p>
       </td>
       <td>необязательный параметр, int (числовое значение), по умолчанию 1</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на каждый запрос в массиве data. Соответствующий объект в выходном массиве содержит id изменяемого клиента и, в случае возникновения ошибки, поля error_code и error_desc.
<p>Errors:</p>
<pre>  100 - unknown campaign
   102 - unknown client</pre>
==Список кампаний рекламного кабинета==
Для получения списка кампаний рекламного кабинета используется метод <b>ads.campaigns.get</b>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>Идентификатор клиента, у которого запрашиваются рекламные кампании</td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>include_archive</td>
       <td>Флаг, задающий необходимость вывода архивных объявлений: 
           <p>0 - выводить только активные кампании;</p>
           <p>1 - выводить все кампании</p>
       </td>
       <td>Флаг, может принимать значения 1 или 0</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_ids</td>
       <td>Фильтр выводимых рекламных кампаний.
           <p>Сериализованный JSON-массив, содержащий id кампаний. Выводиться будут только кампании, присутствующие в campaign_ids и являющиеся кампаниями указанного рекламного кабинета. Если параметр равен null, то выводиться будут все кампании.</p> 
       </td>
       <td>Строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>with_bwlist</td>
       <td>Флаг передачи блек- и вайт-листов</td>
       <td>любое значение (например 1)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>with_tags</td>
       <td>Флаг передачи ключевых слов</td>
       <td>любое значение (например 1)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>limit</td>
       <td>ограничение на количество возвращаемых кампаний. Используется, только если параметр campaign_ids равен null</td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>offset</td>
       <td>смещение. Используется в тех же случаях, что и параметр limit</td>
       <td>int (числовое значение)</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив объектов campaign, каждый из которых содержит следующие поля:
<code>
<pre>
response: {
       count: %total%,
       items: [{
  id — идентификатор кампании
  name — название кампании
  status — статус кампании (0 — кампания остановлена, 1 — кампания запущена, 2 — кампания удалена)
  day_limit — дневной лимит кампании в рублях (0 — лимит не задан)
  all_limit — общий лимит кампании в рублях (0 — лимит не задан)
  ad_format — формат объявления
  cost_type — тип оплаты
  link_url - ссылка на рекламируемый объект
  sex - пол
  age - возраст
  regions - идентификаторы регионов
  categories - идентификаторы категорий.
  adult_content - присутсвие контент для взрослых
  adult_site - отображение объявлений кампании на сайтах с контентом для взрослых
           tags - ключевые слова
           bw_list - блек- и вайт-лист 
     },..]
}
</pre>
</code>
<p>Errors:</p>
<pre>  102 - unknown client</pre>
==Архивирование рекламной кампании==
Для архивирования рекламной кампании используется метод <b>ads.campaigns.delete</b><br> 
Максимальное допустимое количество клиентов, редактируемых с помощью одного запроса — 10.<br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ids</td>
       <td>Список id кампаний через запятую или массив с id кампаниями. 
         <p>Например:</p>
         <p>“id1, id2, …, idn“ или [id1, id2, …, idn]</p>
       </td>
       <td>обязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на каждый запрос. Каждый ответ является либо 0, что означает успешное удаление, либо массив error.
<p>Errors:</p>
<pre>  100 - unknown campaign
   101 - campaign already archive
   102 - unknown client</pre>
==Получение кодов для СРА кампаний==
Для получения кодов по СРА кампаниям используется метод <b>ads.campaigns.cpa.mode.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>id кампании</td>
       <td>int (числовое значение), обязательный параметр</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает объект с данными.
<code>
<pre>
{
response: {
url: %url%
                 }
}
</pre>
</code>
==Получение списка категорий по заданому фильтру==
Для возврата списка категорий по заданому фильтру используется метод <b>ads.campaigns.categories.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ad_format</td>
       <td>формат объявления:
           <p>ads.campaigns.foarmats.get</p>
       </td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>category_id</td>
       <td>id категории. ограничивает отображение только по id категории</td>
       <td>необязательный параметр,  int (числовое значение)</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response. 
<code>
<pre>
response: {
           count: %total%,
           items: [{
                       %category_id%: {
                           %region_id%: {
                        min: %min_cost%,
                        max: %max_cost%
                             }
                       }
                 },..]
}
</pre>
</code>
==Получение списка форматов объявлений==
Для получения списка форматов объявлений используется метод <b>ads.campaigns.formats.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response. 
<code>
<pre>
response: {
       count: %total%,
       items: [{
             id: %format_id%,
             title: ‘%format title%’
       },..]
}
</pre>
</code>
==Получение списка платформ==
Для получения списка платформ используется метод <b>ads.targeting.platforms.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response.  
<code>
<pre>
response: {
       count: %,
       items: [{
           id: %platform_id%,
           title: %platform_name%,
           mobile: %is mobile%
       },..]
}
</pre>
</code>
==Получение списка браузеров==
Для получения списка браузеров используется метод <b>ads.targeting.browsers.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response.  
<code>
<pre>
response: {
       count: %,
       items: [{
           id: %browser_id%,
           title: %browser_name%,
       },..]
}
</pre>
</code>
==Получение списка уведомлений о конверсиях для СРА==
Для получения списка уведомлений о конверсиях для СРА используется метод <b>ads.targeting.cpa.modes.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response.  
<code>
<pre>
response: {
       count: %total%,
       items: [{
           id: %mode_id%,
           title: ‘%mode title%’
       },..]
}
</pre>
</code>
==Получение списка возрастов==
Для получения списка возврастов используется метод <b>ads.targeting.ages.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response.  
<code>
<pre>
response: {
       count: %,
       items: [{
           id: %age_id%,
           title: %age_name%
       },..]
}
</pre>
</code>
==Создание клиентов рекламного агенства==
Для создания клиентов рекламного агенства используется метод <b>ads.clients.put</b><br/>
Допустимое количество создаваемых клиентов с помощью одного запроса — 50.
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>data</td>
       <td>сериализованный JSON-массив объектов, описывающих создаваемые кампании. Описание объектов client_specification см. ниже.</td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_specification</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>name</td>
       <td>название клиента</td>
       <td>строка от 3 до 60 символов, обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>day_limit</td>
       <td>дневной лимит в рублях</td>
       <td>int (числовое значение)</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве data. Соответствующий объект в выходном массиве содержит информацию клиента или массив error  в случае возникновения ошибки (для каждого клиента отдельно). 
<code>
<pre>
{
   client_id — идентификатор клиента;
   name — название клиента;
   day_limit — дневной лимит клиента в рублях;
}
</pre>
</code>
==Редактирование клиентов рекламного агенства==
Для редактирования клиентов рекламного агенства используется метод <b>ads.clients.update</b><br/>
Максимальное допустимое количество клиентов, редактируемых с помощью одного запроса — 50.
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>data</td>
       <td>сериализованный JSON-массив объектов, описывающих изменения в клиентах. Описание объектов client_mod_specification см. ниже.          </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_mod_specification</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>идентификатор редактируемого клиента</td>
       <td>обязательный параметр, положительное число</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>name</td>
       <td>название клиента</td>
       <td>строка длиной от 3 до 60 символов</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>day_limit</td>
       <td>дневной лимит в рублях</td>
       <td>положительное число</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на каждый запрос в массиве data. Соответствующий объект в выходном массиве содержит id изменяемого клиента и, в случае возникновения ошибки, поля error_code иerror_desc.
==Получение списка клиентов рекламного агенства==
Для возврата списка клиентов рекламного агенства используется метод <b>ads.clients.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_ids</td>
       <td>Список id клиентов через запятую. Например: “id1, id2, …, idn“</td>
       <td>необязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив объектов client — клиентов агентства, каждый из которых содержит следующие поля: 
<code>
<pre>
response: {
     count: %total%,
     items: [{
           client_id — идентификатор клиента;
           name — название клиента;
           day_limit — дневной лимит клиента в рублях;
           balance - баланс клиента
     },..]
}
</pre>
</code>
==Архивирование клиентов рекламного агенства==
Для архивирования клиентов рекламного агенства используется метод <b>ads.clients.delete</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ids</td>
       <td>Список id клиентов через запятую или массив с id клиентами. 
           <p>Например: “id1, id2, …, idn“ или [id1, id2, …, idn]</p>
     </td>
       <td>обязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на каждый запрос. Каждый ответ является либо 0, что означает успешное удаление, либо массив error.
==Подвязывание клиента к рекламному агенству==
Для подвязывания клиента к рекламному агенству используется метод <b>ads.clients.bind.put</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>email</td>
       <td>email адрес клиента</td>
       <td>строка от 3 до 60 символов, обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>password</td>
       <td>пароль клиента (от кабинета)</td>
       <td>строка от 3 до 60 символов, обязательный параметр</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает: 
<code>
<pre>
{
“bind”: true
}
</pre>
</code>
в случае успеха. Или error в случае возникновения ошибки.
==Открепление клиента от рекламного агенства==
Для открепления клиента от рекламного агенства используется метод <b>ads.clients.unbind.put</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>id клиента</td>
       <td>int (числовое значение)</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает: 
<code>
<pre>
{
“unbind”: true
}
</pre>
</code>
в случае успеха. Или error в случае возникновения ошибки.
==Пополнение счета клиента==
Для пополнения счета клиента используется метод <b>ads.clients.balance.put</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>id клиента для пополнения</td>
       <td>int (числовое значение), обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>sum</td>
       <td>сума в рублях</td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>back_url</td>
       <td>url куда переадресует клиента система пополнения</td>
       <td>string (строка)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>system_id</td>
       <td>id системы пополнения:
             <p>data.balance.systems.get</p>
       </td>
       <td>int (числовое значение), обязательный параметр</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает url для оплаты: 
<code>
<pre>
{
response: {
url: %url%
                 }
}
</pre>
</code>
==Создание рекламных объявлений==
Для создания рекламных объявлений используется метод <b>ads.materials.put</b><br/>
Максимальное допустимое количество объявлений, создаваемых с помощью одного запроса — 20.
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>data</td>
       <td>сериализованный JSON-массив объектов, описывающих создаваемые объявления. Описание объектов ad_specification см. ниже. </td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ad_specification</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>id кампании, в которой будет создаваться объявление</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>title</td>
       <td>заголовок объявления</td>
       <td>обязательный параметр</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>text</td>
       <td>описание объявления</td>
       <td>обязательно</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>link_url</td>
       <td>ссылка рекламируемого объекта в формате: http://yoursite.cоm</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>link_media</td>
       <td>загруженный ранее медиа объект (jpg, gif):
             <p>data.upload.media</p>
       </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>pause_after_moderate</td>
       <td>установка объявления на паузу после модерации</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>size</td>
       <td>только для банеров:
             <p>ads.materials.banner.sizes</p>
       </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>categories</td>
       <td>Стаки по категориям, аналогично как и для кампаний:
         <p>массив [category_id => cost]</p>
       </td>
<td>Не обязательно, если не задавать будут использоваться ставки из категорий кампании</td>
   </tr>
</table>
==Обновление данных рекламных объявлений==
Для обновления данных рекламных объявлений используется метод <b>ads.materials.update</b><br/>
Максимальное допустимое количество объявлений, создаваемых с помощью одного запроса — 20.
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>data</td>
       <td>сериализованный JSON-массив объектов, описывающих создаваемые объявления. Описание объектов ad_specification см. ниже</td>
       <td>обязательный параметр, строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ad_specification</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>material_id</td>
       <td>id объявления</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>status</td>
       <td>запуск/приостановка материала: 
           <p>0 - приостановлена;</p>
           <p>1 - запущена</p>
       </td>
       <td>необязательный параметр, int (числовое значение), по умолчанию 1</td>
   </tr>
</table>
==Архивирование рекламных объявлений==
Для архивирования рекламных объявлений используется метод <b>ads.materials.delete</b><br/>
Максимальное допустимое количество клиентов, редактируемых с помощью одного запроса — 50.
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>account_id</td>
       <td>идентификатор рекламного кабинета</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ids</td>
       <td>сериализованный JSON-массив, содержащий идентификаторы объявлений</td>
       <td>обязательный параметр, строка</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на каждый запрос. Каждый ответ является либо 0, что означает успешное удаление, либо массив error.
==Получение списка рекламных объявлений==
Для получения списка рекламных объявлений используется метод <b>ads.materials.get</b>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>account_id</td>
       <td>идентификатор рекламного кабинета</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>Для рекламных агентств. Идентификатор клиента, у которого запрашиваются рекламные объявления.</td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>archive</td>
       <td>Флаг, задающий необходимость вывода архивных объявлений: 
           <p>0 - выводить только активные объявления;</p>
           <p>1 - выводить все объявления</p>
       </td>
       <td>Флаг, может принимать значения 1 или 0</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_ids</td>
       <td>фильтр по рекламным кампаниям.
             <p>Сериализованный JSON-массив, содержащий id кампаний. Если параметр равен null, то будут выводиться рекламные объявления всех кампаний.</p>
       </td>
       <td>строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>material_ids</td>
       <td>фильтр по рекламным кампаниям.
             <p>Сериализованный JSON-массив, содержащий id объявлений. Если параметр равен null, то будут выводиться все рекламные объявления.</p>
       </td>
       <td>строка</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>limit</td>
       <td>ограничение на количество возвращаемых объявлений. Используется, только если параметр ad_ids равен null, а параметр campaign_ids содержит id только одной кампании. 
       </td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>offset</td>
       <td>смещение. Используется в тех же случаях, что и параметр limit</td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ad_format</td>
       <td>формат объявления: ads.campaigns.formats.get</td>
       <td>обязательный параметр, int (числовое значение)</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив объектов ad, каждый из которых содержит следующие поля: 
  <ul type="disc">
       <li><b>id</b> — идентификатор объявления</li>
       <li><b>name</b> — название объявления</li>
       <li><b>campaign_id</b> — идентификатор кампании</li>
       <li><b>link_url</b></li>
       <li><b>arhive</b></li>
       <li><b>ad_format</b> — формат объявления</li>
       <li><b>cost_type</b> — тип оплаты</li>
       <li><b>all_limit</b> — общий лимит объявления в рублях</li>
           <ul type="circle">
                       <li>0 — лимит не задан</li>
           </ul>
       <li><b>status </b> — статус объявления:</li>
           <ul type="circle">
                       <li>0 — объявление остановлено;</li>
                       <li>1 — объявление запущено;</li>
                       <li>2 — объявление удалено</li>
           </ul>
       <li><b>approved </b> — статус модерации объявления:</li>
           <ul type="circle">
                       <li>0 — объявление ожидает модерации;</li>
                       <li>10 — объявление одобрено;</li>
                       <li>20 — объявление отклонено</li>
           </ul>
  </ul>
==Получение списка размеров баннеров==
Для получение списка размеров баннеров используется метод <b>ads.materials.banner.sizes.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response:
<code>
<pre>
response: {
       count: %total%,
       items: [{
           id: %banner_id%,
           title: ‘%banner title%’
       },..]
}
</pre>
</code>
==Получение списка стран==
Для получение списка стран используется метод <b>data.geo.countries.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response:
<code>
<pre>
response: {
   count: %,
   items: [{
       id: %country_id%,
       title: %country_name%
   },..]
}
</pre>
</code>
==Получение списка регионов по заданому фильтру==
Для получения списка регионов по заданому фильтру используется метод <b>data.geo.regions.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>country_id</td>
       <td>идентификатор страны, полученный в методе ads.geo.countries</td>
       <td>положительное число, обязательный параметр</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response:
<code>
<pre>
response: {
       count: %,
       items: [{
               id: %region_id%,
               title: %region_name%
       },..]
}
</pre>
</code>
==Получение списка доступных платежных систем==
Для получения списка доступных платежных систем используется метод <b>data.balance.systems.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response:
<code>
<pre>
response: {
       count: %total%,
       items: [{
               id: %pay_system_id%,
               title: ‘%pay system title%’
       },..]
}
</pre>
</code>
==Загрузка медиа файлов==
Для загрузки медиа файлов (jpg, png, gif) используется метод <b>data.upload.media.update</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>ad_format</td>
       <td>формат объявления: /ads.formats.get</td>
       <td>int (числовое значение)</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>file</td>
       <td>CURLFile object</td>
   </tr>
</table>
<b>Результат:</b><br/>
Возвращает массив с ссылкой на конечный объект или error в случае ошибки
<code>
<pre>
response: {
       image: “%link%”
}
</pre>
</code>
Пример отправки файла с использование curl в php:
<code>
<pre>
       $token = ‘полученный токен’;
       $ad_format = ‘формат объявления’;
       $app_id = ‘ваш app id’;
       $file = '@/полный путь к файлу';
</pre>
<pre>
       $finfo = finfo_open(FILEINFO_MIME_TYPE);
       $finfo = finfo_file($finfo, $link);
       $cFile = new \CURLFile($link, $finfo, basename($link));
</pre>
<pre>
       $post = array('file'=>$cFile, 'ad_format' => $ad_format, 'app_id' => $app_id);
       $ignoreParams = array('file'); //поле file не участвует в построении подписи
</pre>
<pre>
       ksort( $post );
</pre>
<pre>
       $result = array ();
       foreach( $post as $key => $value ) {
         if(false == in_array($key, $ignoreParams)) {
      $result[] = $key . '=' . urlencode( $value );
        }
       }
</pre>
<pre>
       $result = implode( '&', $result );
       $signature = md5( $result . $token );
</pre>
<pre>
       $target_url = 'http://api.kadam.net/data.upload.media?signature=' . $signature;
</pre>
<pre>
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL,$target_url);
       curl_setopt($ch, CURLOPT_POST, true);
       curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
</pre>
<pre>
       $result = curl_exec ($ch); //ответ сервера
</pre>
</code>
==Получение текущего времени сервера==
Для получения текущего времени сервера в формате ISO 8601 используется метод <b>server.time.get</b><br/>
<b>Результат:</b><br/>
Возвращает массив ответов на запросы в массиве response:
<code>
<pre>
       {
           iso8601: %time%
       }
</pre>
</code>
==Статистика для Вебмастера==
Для получения статистики по вебмастерам используется метод <b>webmaster.reports.report.get</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>secret</td>
       <td>Ключ доступа для вебмастера(обязательный)</td>
       <td>Можно получить по требованию</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_from</td>
       <td>Начало периода</td>
       <td>строка вида "YYYY-MM-DD", не обязательный параметр, в случае отсутствия будет взята текущая дата</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_to</td>
       <td>Окончание периода</td>
       <td>строка вида "YYYY-MM-DD", не обязательный параметр, в случае отсутствия будет взята текущая дата</td>
   </tr>       
</table>
<b>Максимальный период выгрузки 1 месяц</b><br/>
<b>Результат:</b><br/>
  <ul type="disc">
       <li><b>blockviews</b> — К-во просмотров блоков</li>
       <li><b>moneyin</b> — Заработано денег</li>
</ul>
Возвращает данные в виде
<code>
<pre>
Array
(
   [responce] => Array
       (
           [2017-11-10] => Array
               (
                   [blockviews] => 300
                   [moneyin] => 100.00
               )
       )
)
</pre>
</code>
==Перевода денег для дочерних аккаунтов агенства==
Для перевода денег используется метод <b>ads.clients.balance.update</b><br/>
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Параметры</th>
       <th width = 300 align = left>Значение</th>
       <th width = 350 align = left>Дополнительные атрибуты</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>client_id</td>
       <td>Идентификатор клиента, ему будут перечислены деньги.</td>
       <td>Обязательное</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>sum</td>
       <td>сумма перевода</td>
       <td>Обязательное</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>type</td>
       <td>Тип операции</td>
       <td>Обязательное - всегда type = "transfer"</td>
   </tr>       
<tr bgcolor = #F5F5F5>
       <td>comment</td>
       <td>Комментарий</td>
       <td>Обязательное - допускается пустое значение</td>
   </tr>       
</table>
<b>Операцию можно совершать только при наличии достаточного кол-ва средств на аккаунте</b><br/>
<b>Деньни будут сняты у поьзователя указанного в app_id </b><br/>
<b>Результат:</b><br/>
Результатом операции будет списание средств с основного пользователя - транзакция вывода. И перевод денег на аккаунт агенства - транзакция ввода. 
Возвращает данные в виде
<code>
<pre>
Array
(
   [status] => "success"
)
</pre>
В случае ошибки - код ошибки
</code>
Перевод== API authorization ==

To access the API, you will need a user ID (app_id) and a signature (signature).
Calling different methods is carried out using queries on this template:
<code>
<pre>
        api.kadam.net?%action%.%method%?%params%
</pre>
<pre>
        % action% - what are we turning to
        % method% - type of treatment
get - get
put - write
post - update
delete - delete
        % params% - request parameters

        required parameters% params%

        app_id - user id
        signature - signature
</pre>
</code>
Example:
<code>
<pre>
       [GET] http://api.kadam.net/campaigns.get?app_id=%app_id%&signature=%signature%
</pre>
</code>
or
<code>
<pre>
       [GET] http://api.kadam.net/campaigns?app_id=%app_id%&signature=%signature%
       [GET] - http access method
</pre>
</code>
'''Signature (signature)''' is created using a temporary token (access_token), which can be obtained using the app_id and secret key parameters.
<br /> Parameters app_id (user ID) and the key "secret key" are available on request to support.
<br /> Getting a token:
<code>
<pre>
       [GET] http://api.kadam.net/auth.token?app_id=%app_id%&secret_key=%key%
       -> {“access_token”: “...”}
</pre>
</code>
Generating signature for the [GET] method:
<code>
<pre>
       md5 ( %sort_params% . %access_token% )
       %sort_params% - all parameters passed (except signature) are sorted by name
</pre>
</code>
Example:
<code>
<pre>
       app_id=1&campaign_id=3…
       [PUT] http://api.kadam.net/campaigns?signature=%signature%
       +post fields -> %params%
</pre>
</code>
Example for php. Getting a list of campaigns:
<code>
<pre>
       <?
       $your_secret_key = "jqhwekq8734quo37o498q3p498qp34";
       $your_app_id = 1;
       $auth_url = "http://api.kadam.net/auth.token?app_id={$your_app_id}&secret_key={$your_secret_key}";
       $auth = file_get_contents($auth_url);
       $auth = json_decode($auth, true);

       if ( !is_array( $auth ) || !isset( $auth['access_token'] ) ) {
           die( 'something wrong! ' . print_r( $res, true ) );
       }

       $token    = $auth['access_token'];
       $params = array(
    'client_id' => $your_app_id,
       'app_id' => $your_app_id,
       );

       ksort( $params );

       $result = array ();
       foreach( $params as $key => $value ) {
           $result[] = $key . '=' . urlencode( $value );
       }
       $params = implode( '&', $result );
       $signature = md5( $params . $token );

       $campaign_url = 'http://api.kadam.net/ads.campaigns.get?' . $params . '&signature=' . $signature;

       $campaigns = file_get_contents($campaign_url);
       $campaigns = json_decode($campaigns, true);

       if ( !is_array( $campaigns ) || !isset( $campaigns['response'] ) ) {
           die( 'something wrong! ' . print_r( $campaigns, true ) );
       }
      
       print_r($campaigns);
      
</pre>
</code>

== Campaign Statistics ==
To get campaign statistics, use the method <b>ads.analytic.campaign.get</b><br />
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left>Parameters</th>
       <th width = 300 align = left>Values</th>
       <th width = 350 align = left>Optional attributes</th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>campaign_id</td>
       <td>campaign's id</td>
       <td>int (numeric value), required parameter</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>region_id</td>
       <td>region's id: data.geo.regions.get</td>
       <td>int (numeric value), required parameter</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>period</td>
       <td>The way data is grouped by date: 
           <p>day — daily statistics;</p>
           <p>month - monthly statistics</p>
           <p>Temporary restrictions are set by parameters date_from and date_to</p>
       </td>
       <td>required parameter, string</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_from</td>
       <td>The starting date of the statistics to display. Different date format is used for different parameter ''period'' values: 
           <p>day: YYYY-MM-DD, example: 2011-09-27;</p>
           <p>month: YYYY-MM, example: 2011-09</p>
       </td>
       <td>required parameter, string</td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td>date_to</td>
       <td>The final date of the displayed statistics. Different date format is used for different parameter ''period'' values: 
           <p>day: YYYY-MM-DD, example: 2011-09-27;</p>
           <p>month: YYYY-MM, example: 2011-09</p>
       </td>
       <td>required parameter, string</td>
   </tr>
</table>
<b>Result:</b><br />
Returns an object with data
<code>
<pre>
{
response: {
count: %total items%
items: {
shows
clicks
ctr
cpm
money
                       }
                 }
}
</pre>
</code>

== Statistics on sites in the advertiser's account ==
Statistics on sites in the advertiser's account means statistics on views and clicks on the site in the context of each campaign.
<br />To get statistics on sites, use the <b> ads.campaigns.statblock.get </b> method (GET request)
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_from </td>
       <td> Start date of the statistics output. </td>
       <td> string, format YYYY-MM-DD (example: 2017-05-15), filter parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_to </td>
       <td> The end date of the statistics output. </td>
       <td> string, format YYYY-MM-DD (example: 2017-05-15), filter parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_id </td>
       <td> campaign id </td>
       <td> required parameter, int (numeric value), filter parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> signature </td>
       <td> Signature (generated using a time token, see above) </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> app_id </td>
       <td> user id </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> macros </td>
       <td> site id </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> leads </td>
       <td> Leads</td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> views </td>
       <td> Views </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> clicks </td>
       <td> Clicks </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> conversions </td>
       <td> Confirmed Conversions </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> rejections </td>
       <td> Failed Conversions </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ctr </td>
       <td> CTR </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> cpm </td>
       <td> CPM </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> cpc </td>
       <td> CPC </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> prelandvisit </td>
       <td> Pre-landing Visits </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> prelanduseful </td>
       <td> Pre-landing Useful visits </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> prelandscroll </td>
       <td> Pre-landing Scroll </td>
       <td> int (numeric value), write parameter, filter option </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an object with data, example:
<code>
<pre>
{
  "response": {
    "count": 1,
    "items": [
      {
        "macros": "12345678901234",
        "block": "1234",
        "domain": "123456789",
        "leads": "0",
        "views": "123",
        "clicks": "0",
        "conversions": "0",
        "rejections": "0",
        "ctr": "0.0000",
        "cpm": "0.00",
        "cpc": null,
        "moneyOut": "0.000000",
        "moneyIn": null,
        "prelandvisit": "0",
        "prelanduseful": "0",
        "prelandscroll": "0",
        "landvisit": "0",
        "landuseful": "0",
        "landscroll": "0",
        "multiplier": null,
        "blackList": "0"
      }
    ],
    "request": {
      "campaignId": 123456,
      "limit": 10,
      "offset": 0
    }
  }
}
</pre>
</code>

'''Sorting'''

Sort Ascending
<code> <pre>
sort = {parameter}
Example: api.kadam.net?sort=views
</pre> </code>

Sort descending
<code> <pre>
sort = - {parameter}
Example: api.kadam.net?sort=-views
</pre> </code>

Sort by several parameters
<code> <pre>
sort = {parameter1}, - {parameter2}, {parameter3}
Example: api.kadam.net?sort=views,-clicks,leads
</pre> </code>

'''Filtration'''
<code> <pre>
{parameter} = {value}
Examples:
api.kadam.net?attr=10
api.kadam.net?attr=string
api.kadam.net?attr=string&date_from=01.05.2016&date_to=01.07.2016
</pre> </code>

== Change the multiplier for statistics on sites in the advertiser's account ==
To change the multiplier for site statistics, use the <b> ads.campaigns.statblock </b> method (PUT request)

Parameters (all are required):
<ul>
<li> app_id - user id, numeric value (int) </li>
<li> signature - signature, string (string) </li>
<li> campaign_id - campaign id, numeric value (int) </li>
<li> block - a numeric value (int) </li>
<li> domain - numeric value (int) </li>
<li> multiplier - new multiplier value, numeric value (float) </li>
<li> multiplierOld - old multiplier value, numeric value (float) </li>
<li> macros - pad id, numeric value (int) </li>
</ul>

The block and macros parameters in the account are not displayed, they can be obtained through the method described in the paragraph "Statistics by sites in the advertiser's account".

== Statistics on all campaign materials ==
To get statistics on all campaign materials, use the <b> ads.analytic.materials.get </b> method <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_id </td>
       <td> campaign id </td>
       <td> int (numeric value), required parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> period </td>
       <td> Method for grouping data by date:
           <p> 1. day - statistics by day; </p>
           <p> 2. month - statistics by months; </p>
           <p> Temporary restrictions are set by date_from and date_to parameters </p>
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_from </td>
       <td> The starting date of the displayed statistics. Different date format is used for different values ​​of the period parameter:
           <p> 1. day: YYYY-MM-DD, Example: 2011-09-27 </p>
           <p> 2. month: YYYY-MM, example: 2011-09 </p>
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_to </td>
       <td> End date of output statistics. Different date format is used for different values ​​of the period parameter:
           <p> 1. day: YYYY-MM-DD, Example: 2011-09-27 </p>
           <p> 2. month: YYYY-MM, example: 2011-09 </p>
       </td>
       <td> required parameter, string </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an object with data
<code>
<pre>
{
response: {
count:% total items%
items: {
teaser_id
date
shows
clicks
ctr
cpm
money
                       }
                  }
}
</pre>
</code>

== Material statistics ==
For statistics on the material, use the method <b> ads.analytic.material.get </b> <br />
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> material_id </td>
       <td> material id </td>
       <td> int (numeric value), required parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> period </td>
       <td> Method for grouping data by date:
           <p> 1. day - statistics by day; </p>
           <p> 2. month - statistics by months; </p>
           <p> Temporary restrictions are set by date_from and date_to parameters </p>
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_from </td>
       <td> The starting date of the displayed statistics. Different date format is used for different values ​​of the period parameter:
           <p> 1. day: YYYY-MM-DD, Example: 2011-09-27 </p>
           <p> 2. month: YYYY-MM, example: 2011-09 </p>
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_to </td>
       <td> End date of output statistics. Different date format is used for different values ​​of the period parameter:
           <p> 1. day: YYYY-MM-DD, Example: 2011-09-27 </p>
           <p> 2. month: YYYY-MM, example: 2011-09 </p>
       </td>
       <td> required parameter, string </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an object with data
<code>
<pre>
{
response: {
count:% total items%
items: {
date
shows
clicks
ctr
cpm
money
                       }
                  }
}
</pre>
</code>

== Creating an advertising campaign ==
To create a new advertising campaign, use the <b> ads.campaigns.put </b> <br /> method
The number of campaigns created with a single request is 50. <br />
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> data </​​td>
       <td> a serialized JSON array of objects describing the campaigns being created. See the client_specification object description below. </Td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_specification </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> app_id </td>
       <td> user id </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> id of the client in whose advertising account the campaign will be created. It can also take the value app_id (itself)
       </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ad_format </td>
       <td> Ad Format:
           <p> 10 - Teaser; </p>
           <p> 20 - Banner; </p>
           <p> 30 - Push Notifications; </p>
           <p> 40 - Clickunder; </p>
           <p> 60 - Contextual </p>
       </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> cost_type </td>
       <td> Payment method:
           <p> 0 - CPC; </p>
           <p> 1 - CPA; </p>
           <p> 2 - CPM </p>
       </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> name </td>
       <td> campaign name
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> Link_url </td>
       <td> link to the advertised object in the format: http: //yoursite.cоm
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> real_url </td>
       <td> link to the real domain of the advertised object in the format: http: //yoursite.cоm
       </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> sex </td>
       <td> Gender:
           <p> 3 - any; </p>
           <p> 2 - male; </p>
           <p> 1 - female </p>
       </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> age </td>
       <td> The age of the target audience. Age category number from 1 to 6 (up to 17, 18-25, 26-34, 35-49, 50-60, over 61) </td>
       <td> required parameter, a sequence of numbers separated by a comma </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> regions </td>
       <td> Regions, from 1 to 10 (1 - Russia, 2 - Ukraine, etc.) </td>
       <td> required parameter, a sequence of numbers separated by a comma </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> cpa_mode </td>
       <td> Type of conversion notifications for CPA: /ads.targeting.modes.get </td>
       <td> int (numeric value), mandatory for CPA campaigns </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> categories </td>
       <td> <p> category IDs: </p>
           <p> /data.categories.get?ad_format =% </p>
           
       </td>
       <td> <p> array [category_id => cost] </p> </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> tags </td>
       <td> keyword targeting </td>
       <td> <p> required parameter, a sequence of keywords separated by a comma: [“key1”, “key2”, .., “keyN”] </p>
           <p> Keywords with price. Only for payment - for clicks or for views: {“key1”: “cost”, “key2”: “cost”, .., “keyN”: “cost”} </p>
           <p> cost - float </p>
           <p> example: "data [tags] [qwerty]: 1" is the qwerty keyword with a 1rub rate. </p>
       </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> day_limit </td>
       <td> Daily limit in rubles. For all types except clickunder </td>
       <td> positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> all_limit </td>
       <td> Total limit in rubles. For all types except clickunder </td>
       <td> positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> click_limit </td>
       <td> Maximum count. transitions per day. For all types except clickunder. For views and clicks. </Td>
       <td> positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> conversion_limit </td>
       <td> Maximum count. conversions per day. For all types except clickunder. Only for CPA </td>
       <td> positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> adult_content </td>
       <td> presence of adult content in the advertising campaign:
           <p> 0 - No; </p>
           <p> 1 - Yes </p>
       </td>
       <td> optional parameter, int (numeric value), default 0 </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> adult_site </td>
       <td> Display campaign ads on adult content sites:
           <p> 0 - No; </p>
           <p> 1 - Yes </p>
       </td>
       <td> optional parameter, int (numeric value), default 0 </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> time_show </td>
       <td> Time Targeting:
           <p> & nbsp; & nbsp; * - display in any hours and days of the week </p>
           <p> & nbsp; & nbsp; {} is an array, where the key is the name of the day of the week ["Sn", "Mn", "Tu", "Wd", "Th", "Fr", "Sa"]: </p>
           <p> & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: ‘*’ - all watches are weekly </p>
           <p> & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: [0, .., 23] - hours, separated by commas </p>
       </td>
       <td> optional parameter, * default </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> platforms </td>
       <td> platform targeting: /data.platforms </td>
       <td> comma separated numbers </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> browsers </td>
       <td> browser targeting: /data.browsers </td>
       <td> comma separated numbers </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> black_list </td>
       <td> black list of sites where ads will not be shown </td>
       <td> comma separated site ID number sequence </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> white_list </td>
       <td> white list of sites where ads will not be shown </td>
       <td> comma separated site ID number sequence </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> black_list_ip </td>
       <td> ip lock </td>
       <td> sequence of ip addresses separated by a comma or an array </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> unique_day_count </td>
       <td> frequency of material shown to one user (times) </td>
       <td> positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> unique_days </td>
       <td> frequency of advertising material shown to one user (days) </td>
       <td> positive number </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the id of the created campaign, and the error_code and error_desc fields in case of an error.
<p> Errors: </p>
<pre> 102 - unknown client
   103 - overlimit campaigns </pre>

== Editing ad campaigns ==
To edit ad campaigns, use the <b> ads.campaigns.update </b> <br /> method
The maximum number of campaigns edited with a single query is 50. <br />
Version log: 1.0.1 - added status parameter
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> data </​​td>
       <td> is a serialized JSON array of objects describing changes in campaigns. Object descriptions client_mod_specification see below. </Td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_specification </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_id </td>
       <td> id of the edited campaign
       </td>
       <td> required parameter, positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> name </td>
       <td> campaign name </td>
       <td> optional parameter, a string between 3 and 60 characters </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> link_url </td>
       <td> link to the advertised object in the format http: //yoursite.com </td>
       <td> optional parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> real_url </td>
       <td> link to the real domain of the advertised object in the format: http: //yoursite.cоm
       </td>
       <td> optional parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> sex </td>
       <td> Gender:
           <p> 3 - any; </p>
           <p> 2 - male; </p>
           <p> 1 - female </p>
       </td>
       <td> optional parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> age </td>
       <td> age: /data.ages </td>
       <td> optional parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> categories </td>
       <td> category IDs:
           <p> /data.categories.get?ad_format =% </p>
           <p> category_id: {region_id: cost} </p>
       </td>
       <td> optional parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> tags </td>
       <td> keyword targeting </td>
       <td> optional parameter, comma separated keyword sequence </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> day_limit </td>
       <td> daily limit in rubles. for all types except clickunder </td>
       <td> optional parameter, positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> adult_content </td>
       <td> presence of adult content in the advertising campaign:
           <p> 0 - No; </p>
           <p> 1 - Yes </p>
       </td>
       <td> optional parameter, int (numeric value), default 0 </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> adult_site </td>
       <td> display campaign ads on adult content sites:
           <p> 0 - No; </p>
           <p> 1 - Yes </p>
       </td>
       <td> optional parameter, int (numeric value), default 0 </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> time_show </td>
       <td> Time Targeting:
           <p> & nbsp; & nbsp; * - display in any hours and days of the week </p>
           <p> & nbsp; & nbsp; {} is an array, where the key is the name of the day of the week ["Sn", "Mn", "Tu", "Wd", "Th", "Fr", "Sa"]: </p>
           <p> & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: ‘*’ - all watches are weekly </p>
           <p> & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: [0, .., 23] - hours, separated by commas </p>
       </td>
       <td> optional parameter, * default </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> platforms </td>
       <td> platform targeting: /data.platforms </td>
       <td> comma separated numbers </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> browsers </td>
       <td> browser targeting: /data.browsers </td>
       <td> comma separated numbers </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> black_list </td>
       <td> black list of sites where ads will not be shown </td>
       <td> comma separated site ID number sequence </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> white_list </td>
       <td> white list of sites where ads will not be shown </td>
       <td> comma separated site ID number sequence </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> black_list_ip </td>
       <td> ip lock </td>
       <td> sequence of ip addresses separated by a comma or an array </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> status </td>
       <td> start /pause campaign:
           <p> 0 - suspended; </p>
           <p> 1 - running </p>
       </td>
       <td> optional parameter, int (numeric value), default 1 </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.
<p> Errors: </p>
<pre> 100 - unknown campaign
    102 - unknown client </pre>

== List of campaign advertising campaign ==
To get a list of campaign advertising campaigns use the method <b> ads.campaigns.get </b>

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> Client ID from which ad campaigns are requested </td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> include_archive </td>
       <td> A flag that specifies whether to display archived ads:
           <p> 0 - show only active campaigns; </p>
           <p> 1 - show all campaigns </p>
       </td>
       <td> Flag, can be 1 or 0 </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_ids </td>
       <td> Filter for displayed ad campaigns.
           <p> Serialized JSON array containing campaign id. Only campaigns that are present in the campaign_ids and are campaigns of the specified advertising cabinet will be displayed. If the parameter is null, then all campaigns will be displayed. </P>
       </td>
       <td> String </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> with_bwlist </td>
       <td> Black and white list transfer flag </td>
       <td> any value (for example 1) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> with_tags </td>
       <td> Keyword Transfer Flag </td>
       <td> any value (for example 1) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> limit </td>
       <td> limit on the number of campaigns returned. Used only if the campaign_ids parameter is null </td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> offset </td>
       <td> offset. Used in the same cases as the limit parameter </td>
       <td> int (numeric value) </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an array of campaign objects, each of which contains the following fields:
<code>
<pre>
response: {
       count:% total%
       items: [{
id - campaign identifier
name - campaign name
status - campaign status (0 - campaign stopped, 1 - campaign started, 2 - campaign deleted)
day_limit - campaign daily limit in rubles (0 - no limit is set)
all_limit - total campaign limit in rubles (0 - no limit is set)
ad_format - ad format
cost_type - payment type
link_url - link to the advertised object
sex
age - age
regions - region identifiers
categories - category identifiers.
adult_content - the presence of adult content
adult_site - display campaign ads on adult content sites
           tags - keywords
           bw_list - black and white list
      }, ..]
}
</pre>
</code>
<p> Errors: </p>
<pre> 102 - unknown client </pre>

== Archiving an advertising campaign ==
To archive an advertising campaign, use the <b> ads.campaigns.delete </b> <br /> method
The maximum number of clients edited with a single query is 10. <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ids </td>
       <td> Campaign id list separated by comma or array with id campaigns.
          <p> For example: </p>
          <p> “id1, id2, ..., idn“ or [id1, id2, ..., idn] </p>
       </td>
       <td> required parameter, string </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.
<p> Errors: </p>
<pre> 100 - unknown campaign
   101 - campaign already archive
   102 - unknown client </pre>

== Receiving codes for CPA campaigns ==
Use the <b> ads.campaigns.cpa.mode.get </b> <br /> method to get the codes for the CPA campaigns

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_id </td>
       <td> campaign id </td>
       <td> int (numeric value), required parameter </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an object with data.
<code>
<pre>
{
response: {
url:% url%
                  }
}
</pre>
</code>

== Getting a list of categories for a given filter ==
To return the list of categories for a given filter, use the <b> ads.campaigns.categories.get </b> <br /> method

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ad_format </td>
       <td> ad format:
            <p> ads.campaigns.foarmats.get </p>
       </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> category_id </td>
       <td> category id. limits displaying only by category id </td>
       <td> optional parameter, int (numeric value) </td>
   </tr>
</table>
<b> Result: </b> <br />
Returns an array of responses to queries in the response array.
<code>
<pre>
response: {
            count:% total%
            items: [{
                       % category_id%: {
                            % region_id%: {
min:% min_cost%
max:% max_cost%
                             }
                       }
                  }, ..]
}
</pre>
</code>

== Getting the list of ad formats ==
Use the <b> ads.campaigns.formats.get </b> <br /> method to get the list of ad formats.

<b> Result: </b> <br />
Returns an array of responses to queries in the response array.
<code>
<pre>
response: {
       count:% total%
       items: [{
             id:% format_id%
             title: ‘% format title%’
       }, ..]
}
</pre>
</code>

== Getting the list of platforms ==
For a list of platforms, use the <b> ads.targeting.platforms.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to queries in the response array.
<code>
<pre>
response: {
       count:%
       items: [{
           id:% platform_id%
           title:% platform_name%,
           mobile:% is mobile%
       }, ..]
}
</pre>
</code>

== Getting Browser List ==
For a list of browsers, use the <b> ads.targeting.browsers.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to queries in the response array.
<code>
<pre>
response: {
       count:%
       items: [{
           id:% browser_id%,
           title:% browser_name%,
       }, ..]
}
</pre>
</code>

== Getting a list of conversion notifications for the CPA ==
To get a list of conversion notifications for CPA, use the <b> ads.targeting.cpa.modes.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to queries in the response array.
<code>
<pre>
response: {
       count:% total%
       items: [{
           id:% mode_id%
           title: ‘% mode title%’
       }, ..]
}
</pre>
</code>

== Getting a list of ages ==
To get the list of views, use the <b> ads.targeting.ages.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to queries in the response array.
<code>
<pre>
response: {
       count:%
       items: [{
           id:% age_id%
           title:% age_name%
       }, ..]
}
</pre>
</code>

== Creating advertising agency clients ==
To create ad agency clients, use the <b> ads.clients.put method </b> <br />
The allowable number of clients created with a single request is 50.

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> data </​​td>
       <td> a serialized JSON array of objects describing the campaigns being created. See the client_specification object description below. </Td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_specification </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> name </td>
       <td> client name </td>
       <td> string from 3 to 60 characters, required parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> day_limit </td>
       <td> daily limit in rubles </td>
       <td> int (numeric value) </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the client information or the error array in case of an error (for each client separately).
<code>
<pre>
{
    client_id - client identifier;
    name - the name of the client;
    day_limit - client's daily limit in rubles;
}
</pre>
</code>

== Editing advertising agency clients ==
To edit ad agency clients, use the <b> ads.clients.update method </b> <br />
The maximum number of clients edited with a single query is 50.

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> data </​​td>
       <td> is a serialized JSON array of objects describing changes in clients. Description of client_mod_specification objects see below. </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_mod_specification </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> ID of the client being edited </td>
       <td> required parameter, positive number </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> name </td>
       <td> client name </td>
       <td> a string between 3 and 60 characters </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> day_limit </td>
       <td> daily limit in rubles </td>
       <td> positive number </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.

== Getting a list of advertising agency clients ==
To return the list of clients of an advertising agency, use the <b> ads.clients.get method </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_ids </td>
       <td> A list of client ids separated by commas. For example: “id1, id2, ..., idn“ </td>
       <td> optional parameter, string </td>
   </tr>

</table>

<b> Result: </b> <br />
Returns an array of client objects of the agency, each of which contains the following fields:
<code>
<pre>
response: {
      count:% total%
      items: [{
           client_id - client identifier;
           name - the name of the client;
           day_limit - client's daily limit in rubles;
           balance - client's balance
      }, ..]
}
</pre>
</code>

== Archiving advertising agency clients ==
For archiving ad agency clients, use the <b> ads.clients.delete method </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ids </td>
       <td> List of clients' id by comma or array with id clients.
            <p> For example: “id1, id2, ..., idn“ or [id1, id2, ..., idn] </p>
      </td>
       <td> required parameter, string </td>
   </tr>

</table>

<b> Result: </b> <br />
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.

== Tying a client to an advertising agency ==
To bind a client to an advertising agency, use the <b> ads.clients.bind.put method </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> email </td>
       <td> client email address </td>
       <td> string from 3 to 60 characters, required parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> password </td>
       <td> client password (from account) </td>
       <td> string from 3 to 60 characters, required parameter </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns:
<code>
<pre>
{
“Bind”: true
}
</pre>
</code>
in case of success. Or error in case of an error.

== Detaching a client from an advertising agency ==
To detach a client from an advertising agency, use the <b> ads.clients.unbind.put method </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> client id </td>
       <td> int (numeric value) </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns:
<code>
<pre>
{
“Unbind”: true
}
</pre>
</code>
in case of success. Or error in case of an error.

== Customer account replenishment ==
To replenish the client’s account, use the <b> ads.clients.balance.put method </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> customer id to replenish </td>
       <td> int (numeric value), required parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> sum </td>
       <td> rubles in rubles </td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> back_url </td>
       <td> url where the recharge system forwards the client </td>
       <td> string (string) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> system_id </td>
       <td> replenishment system id:
             <p> data.balance.systems.get </p>
       </td>
       <td> int (numeric value), required parameter </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns the url for payment:
<code>
<pre>
{
response: {
url:% url%
                  }
}

</pre>
</code>

== Creating advertisements ==
To create ads using the method <b> ads.materials.put </b> <br />
The maximum allowable number of ads generated by a single request is 20.

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> data </​​td>
       <td> is a serialized JSON array of objects describing the created ads. The description of ad_specification objects is given below. </td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ad_specification </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_id </td>
       <td> id of the campaign in which the ad will be created </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> title </td>
       <td> ad title </td>
       <td> required parameter </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> text </td>
       <td> ad description </td>
       <td> Required </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> link_url </td>
       <td> link of the advertised object in the format: http: //yoursite.com </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> link_media </td>
       <td> previously loaded media object (jpg, gif):
              <p> data.upload.media </p>
       </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> pause_after_moderate </td>
       <td> pause posting moderation </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> size </td>
       <td> for banners only:
              <p> ads.materials.banner.sizes </p>
       </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> categories </td>
       <td> Stacks by category, similar to campaigns:
         <p> array [category_id => cost] </p>
       </td>
<td> Not required if you do not set bids from campaign categories </td>
   </tr>
</table>

== Update ad data ==
Use the <b> ads.materials.update </b> <br /> method to update ad data.
The maximum allowable number of ads generated by a single request is 20.

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> data </​​td>
       <td> is a serialized JSON array of objects describing the created ads. The ad_specification object description is below. </Td>
       <td> required parameter, string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ad_specification </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> material_id </td>
       <td> ad id </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> status </td>
       <td> start /pause material:
           <p> 0 - suspended; </p>
           <p> 1 - running </p>
       </td>
       <td> optional parameter, int (numeric value), default 1 </td>
   </tr>
</table>

== Archiving advertisements ==
For advertising ads using the method <b> ads.materials.delete </b> <br />
The maximum number of clients edited with a single query is 50.

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> account_id </td>
       <td> advertising account ID </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ids </td>
       <td> serialized JSON array containing ad IDs </td>
       <td> required parameter, string </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.

== Getting a list of advertisements ==
Use the <b> ads.materials.get </b> method to get the list of ads.
<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> account_id </td>
       <td> advertising account ID </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> For advertising agencies. Client ID from which advertisements are requested. </Td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> archive </td>
       <td> A flag that specifies whether to display archived ads:
           <p> 0 - display only active ads; </p>
           <p> 1 - display all ads </p>
       </td>
       <td> Flag, can be 1 or 0 </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> campaign_ids </td>
       <td> ad campaign filter.
             <p> Serialized JSON array containing campaign id. If the parameter is null, advertisements of all campaigns will be displayed. </P>
       </td>
       <td> string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> material_ids </td>
       <td> ad campaign filter.
             <p> Serialized JSON array containing ad id. If the parameter is null, all advertisements will be displayed. </P>
       </td>
       <td> string </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> limit </td>
       <td> limit on the number of ads returned. Used only if the ad_ids parameter is null, and the campaign_ids parameter contains the id of only one campaign.
       </td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> offset </td>
       <td> offset. Used in the same cases as the limit parameter </td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ad_format </td>
       <td> ad format: ads.campaigns.formats.get </td>
       <td> required parameter, int (numeric value) </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns an array of ad objects, each of which contains the following fields:
  <ul type = "disc">
       <li> <b> id </b> - ad id </li>
       <li> <b> name </b> - the name of the ad </li>
       <li> <b> campaign_id </b> - Campaign ID </li>
       <li> <b> link_url </b> </li>
       <li> <b> arhive </b> </li>
       <li> <b> ad_format </b> - ad format </li>
       <li> <b> cost_type </b> - payment type </li>
       <li> <b> all_limit </b> - total ad limit in rubles </li>
            <ul type = "circle">
                       <li> 0 - no limit is set </li>
            </ul>
       <li> <b> status </b> - ad status: </li>
            <ul type = "circle">
                       <li> 0 - ad stopped; </li>
                       <li> 1 - the ad is running; </li>
                       <li> 2 - ad deleted </li>
            </ul>
       <li> <b> approved </b> - ad moderation status: </li>
            <ul type = "circle">
                       <li> 0 - the ad is awaiting moderation; </li>
                       <li> 10 - Ad has been approved. </li>
                       <li> 20 - ad disapproved </li>
            </ul>
  </ul>

== Getting a list of banner sizes ==
For a list of banner sizes, use the <b> ads.materials.banner.sizes.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to requests in the response array:
<code>
<pre>
response: {
        count:% total%
        items: [{
             id:% banner_id%,
             title: ‘% banner title%’
        }, ..]
}
</pre>
</code>

== Getting the list of countries ==
To get the list of countries, use the <b> data.geo.countries.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to requests in the response array:
<code>
<pre>
response: {
    count:%
    items: [{
        id:% country_id%,
        title:% country_name%
    }, ..]
}
</pre>
</code>

== Getting a list of regions for a given filter ==
To get a list of regions for a given filter, use the <b> data.geo.regions.get </b> <br /> method

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> country_id </td>
       <td> country identifier obtained in the ads.geo.countries method </td>
       <td> positive number, required parameter </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns an array of responses to requests in the response array:
<code>
<pre>
response: {
        count:%
        items: [{
               id:% region_id%
               title:% region_name%
        }, ..]
}
</pre>
</code>

== Get a list of available payment systems ==
To get a list of available payment systems, use the <b> data.balance.systems.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to requests in the response array:
<code>
<pre>
response: {
         count:% total%
         items: [{
                id:% pay_system_id%,
                title: pay% pay system title% ’
         }, ..]
}
</pre>
</code>

== Download media files ==
To upload media files (jpg, png, gif), use the <b> data.upload.media.update </b> <br /> method

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> ad_format </td>
       <td> ad format: /ads.formats.get </td>
       <td> int (numeric value) </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> file </td>
       <td> CURLFile object </td>
   </tr>
</table>

<b> Result: </b> <br />
Returns an array with a reference to the target object or error in case of an error.
<code>
<pre>
response: {
        image: “% link%”
}
</pre>
</code>
An example of sending a file using curl in php:
<code>
<pre>
       $ token = ‘received token’;
       $ ad_format = объявления ad format ’;
       $ app_id = ‘your app id’;
       $ file = '@ /full path to file';
</pre>
<pre>
       $ finfo = finfo_open (FILEINFO_MIME_TYPE);
       $ finfo = finfo_file ($ finfo, $ link);
       $ cFile = new \ CURLFile ($ link, $ finfo, basename ($ link));
</pre>

<pre>
       $ post = array ('file' => $ cFile, 'ad_format' => $ ad_format, 'app_id' => $ app_id);
       $ ignoreParams = array ('file'); //file field is not involved in the construction of the signature
</pre>
<pre>
       ksort ($ post);
</pre>
<pre>
       $ result = array ();
       foreach ($ post as $ key => $ value) {
         if (false == in_array ($ key, $ ignoreParams)) {
$ result [] = $ key. '='. urlencode ($ value);
}
       }
</pre>
<pre>
       $ result = implode ('&', $ result);
       $ signature = md5 ($ result. $ token);
</pre>
<pre>
       $ target_url = 'http://api.kadam.net/data.upload.media?signature='. $ signature;
</pre>
<pre>
       $ ch = curl_init ();
       curl_setopt ($ ch, CURLOPT_URL, $ target_url);
       curl_setopt ($ ch, CURLOPT_POST, true);
       curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post);
       curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1);
</pre>
<pre>
       $ result = curl_exec ($ ch); //server response
</pre>
</code>

== Get the current server time ==
To get the current server time in ISO 8601 format, use the <b> server.time.get </b> <br /> method

<b> Result: </b> <br />
Returns an array of responses to requests in the response array:
<code>
<pre>
        {
            iso8601:% time%
        }
</pre>
</code>

== Statistics for Webmasters ==
For statistics on webmasters use the method <b> webmaster.reports.report.get </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> secret </td>
       <td> Access key for webmasters (mandatory) </td>
       <td> Available on demand </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_from </td>
       <td> Start of Period </td>
       <td> a string of the form "YYYY-MM-DD" is an optional parameter; if absent, the current date will be taken </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> date_to </td>
       <td> End of Period </td>
       <td> a string of the form "YYYY-MM-DD" is an optional parameter; if absent, the current date will be taken </td>
   </tr>
</table>
<b> Maximum unloading period 1 month </b> <br />
<b> Result: </b> <br />
  <ul type = "disc">
       <li> <b> blockviews </b> - Block Views </li>
       <li> <b> moneyin </b> - Earned money </li>
</ul>
Returns data as
<code>
<pre>
Array
(
    [responce] => Array
        (
            [2017-11-10] => Array
                (
                    [blockviews] => 300
                    [moneyin] => 100.00
                )

        )

)
</pre>
</code>

== Money transfer for subsidiary accounts of the agency ==
To transfer money, use the <b> ads.clients.balance.update method </b> <br />

<table>
   <tr bgcolor = #DCDCDC>
       <th width = 130 align = left> Parameters </th>
       <th width = 300 align = left> Value </th>
       <th width = 350 align = left> Additional attributes </th>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> client_id </td>
       <td> Customer ID, money will be transferred to it. </td>
       <td> Required </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> sum </td>
       <td> transfer amount </td>
       <td> Required </td>
   </tr>
   <tr bgcolor = #F5F5F5>
       <td> type </td>
       <td> Operation Type </td>
       <td> Required - always type = "transfer" </td>
   </tr>
<tr bgcolor = #F5F5F5>
       <td> comment </td>
       <td> Comment </td>
       <td> Required - null value allowed </td>
   </tr>
</table>
<b> The operation can be performed only if there are sufficient funds on the account </b> <br />
<b> Money will be withdrawn from the user specified in the app_id </b> <br />
<b> Result: </b> <br />
The result of the operation will be the withdrawal of funds from the primary user - an output transaction. And the transfer of money to the agency account is an input transaction.

Returns data as
<code>
<pre>
Array
(
    [status] => "success"

)
</pre>
In case of error - error code
</code>

API authorization

To access the API, you will need a user ID (app_id) and a signature (signature). Calling different methods is carried out using queries on this template:

        api.kadam.net?%action%.%method%?%params%
        % action% - what are we turning to
        % method% - type of treatment
get - get
put - write
post - update
delete - delete
        % params% - request parameters

        required parameters% params%

        app_id - user id
        signature - signature

Example:

       [GET] http://api.kadam.net/campaigns.get?app_id=%app_id%&signature=%signature%

or

       [GET] http://api.kadam.net/campaigns?app_id=%app_id%&signature=%signature%
       [GET] - http access method

Signature (signature) is created using a temporary token (access_token), which can be obtained using the app_id and secret key parameters.
Parameters app_id (user ID) and the key "secret key" are available on request to support.
Getting a token:

       [GET] http://api.kadam.net/auth.token?app_id=%app_id%&secret_key=%key%
       -> {“access_token”: “...”}

Generating signature for the [GET] method:

       md5 ( %sort_params% . %access_token% )
       %sort_params% - all parameters passed (except signature) are sorted by name

Example:

       app_id=1&campaign_id=3…
       [PUT] http://api.kadam.net/campaigns?signature=%signature%
       +post fields -> %params%

Example for php. Getting a list of campaigns:

       <?
        $your_secret_key = "jqhwekq8734quo37o498q3p498qp34";
       $your_app_id = 1;
       $auth_url = "http://api.kadam.net/auth.token?app_id={$your_app_id}&secret_key={$your_secret_key}";
       $auth = file_get_contents($auth_url);
       $auth = json_decode($auth, true);

       if ( !is_array( $auth ) || !isset( $auth['access_token'] ) ) {
           die( 'something wrong! ' . print_r( $res, true ) );
       }

       $token    = $auth['access_token'];
       $params = array(
	    'client_id' => $your_app_id,
        'app_id' => $your_app_id,
       );

       ksort( $params );

       $result = array ();
       foreach( $params as $key => $value ) {
           $result[] = $key . '=' . urlencode( $value );
       }
       $params = implode( '&', $result );
       $signature = md5( $params . $token );

       $campaign_url = 'http://api.kadam.net/ads.campaigns.get?' . $params . '&signature=' . $signature;

       $campaigns = file_get_contents($campaign_url);
       $campaigns = json_decode($campaigns, true);

       if ( !is_array( $campaigns ) || !isset( $campaigns['response'] ) ) {
           die( 'something wrong! ' . print_r( $campaigns, true ) );
       }
       
       print_r($campaigns);
       

Campaign Statistics

To get campaign statistics, use the method ads.analytic.campaign.get

Parameters Values Optional attributes
campaign_id campaign's id int (numeric value), required parameter
region_id region's id: data.geo.regions.get int (numeric value), required parameter
period The way data is grouped by date:

day — daily statistics;

month - monthly statistics

Temporary restrictions are set by parameters date_from and date_to

required parameter, string
date_from The starting date of the statistics to display. Different date format is used for different parameter period values:

day: YYYY-MM-DD, example: 2011-09-27;

month: YYYY-MM, example: 2011-09

required parameter, string
date_to The final date of the displayed statistics. Different date format is used for different parameter period values:

day: YYYY-MM-DD, example: 2011-09-27;

month: YYYY-MM, example: 2011-09

required parameter, string

Result:
Returns an object with data

{
	response: {
		count: %total items%
		items: {
			shows
			clicks
			ctr
			cpm
			money
                       }
                  }
}

Statistics on sites in the advertiser's account

Statistics on sites in the advertiser's account means statistics on views and clicks on the site in the context of each campaign.
To get statistics on sites, use the ads.campaigns.statblock.get method (GET request)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
Parameters Value Additional attributes
date_from Start date of the statistics output. string, format YYYY-MM-DD (example: 2017-05-15), filter parameter
date_to The end date of the statistics output. string, format YYYY-MM-DD (example: 2017-05-15), filter parameter
campaign_id campaign id required parameter, int (numeric value), filter parameter
signature Signature (generated using a time token, see above) required parameter, string
app_id user id required parameter, int (numeric value)
macros site id int (numeric value), write parameter, filter option
leads Leads int (numeric value), write parameter, filter option
views Views int (numeric value), write parameter, filter option
clicks Clicks int (numeric value), write parameter, filter option
conversions Confirmed Conversions int (numeric value), write parameter, filter option
rejections Failed Conversions int (numeric value), write parameter, filter option
ctr CTR int (numeric value), write parameter, filter option
cpm CPM int (numeric value), write parameter, filter option
cpc CPC int (numeric value), write parameter, filter option
prelandvisit Pre-landing Visits int (numeric value), write parameter, filter option
prelanduseful Pre-landing Useful visits int (numeric value), write parameter, filter option
prelandscroll Pre-landing Scroll int (numeric value), write parameter, filter option

Result:
Returns an object with data, example:

{
  "response": {
    "count": 1,
    "items": [
      {
        "macros": "12345678901234",
        "block": "1234",
        "domain": "123456789",
        "leads": "0",
        "views": "123",
        "clicks": "0",
        "conversions": "0",
        "rejections": "0",
        "ctr": "0.0000",
        "cpm": "0.00",
        "cpc": null,
        "moneyOut": "0.000000",
        "moneyIn": null,
        "prelandvisit": "0",
        "prelanduseful": "0",
        "prelandscroll": "0",
        "landvisit": "0",
        "landuseful": "0",
        "landscroll": "0",
        "multiplier": null,
        "blackList": "0"
      }
    ],
    "request": {
      "campaignId": 123456,
      "limit": 10,
      "offset": 0
    }
  }
}

Sorting

Sort Ascending

sort = {parameter}
Example: api.kadam.net?sort=views

Sort descending

sort = - {parameter}
Example: api.kadam.net?sort=-views

Sort by several parameters

sort = {parameter1}, - {parameter2}, {parameter3}
Example: api.kadam.net?sort=views,-clicks,leads

Filtration

{parameter} = {value}
Examples:
api.kadam.net?attr=10
api.kadam.net?attr=string
api.kadam.net?attr=string&date_from=01.05.2016&date_to=01.07.2016

Change the multiplier for statistics on sites in the advertiser's account

To change the multiplier for site statistics, use the ads.campaigns.statblock method (PUT request)

Parameters (all are required):

  • app_id - user id, numeric value (int)
  • signature - signature, string (string)
  • campaign_id - campaign id, numeric value (int)
  • block - a numeric value (int)
  • domain - numeric value (int)
  • multiplier - new multiplier value, numeric value (float)
  • multiplierOld - old multiplier value, numeric value (float)
  • macros - pad id, numeric value (int)

The block and macros parameters in the account are not displayed, they can be obtained through the method described in the paragraph "Statistics by sites in the advertiser's account".

Statistics on all campaign materials

To get statistics on all campaign materials, use the ads.analytic.materials.get method

                                                                                                                                                               
Parameters Value Additional attributes
campaign_id campaign id int (numeric value), required parameter
period Method for grouping data by date:            

1. day - statistics by day;

           

2. month - statistics by months;

           

Temporary restrictions are set by date_from and date_to parameters

       
required parameter, string
date_from The starting date of the displayed statistics. Different date format is used for different values ​​of the period parameter:            

1. day: YYYY-MM-DD, Example: 2011-09-27

           

2. month: YYYY-MM, example: 2011-09

       
required parameter, string
date_to End date of output statistics. Different date format is used for different values ​​of the period parameter:            

1. day: YYYY-MM-DD, Example: 2011-09-27

           

2. month: YYYY-MM, example: 2011-09

       
required parameter, string

Result:
Returns an object with data

{
response: {
count:% total items%
items: {
teaser_id
date
shows
clicks
ctr
cpm
money
                       }
                  }
}

Material statistics

For statistics on the material, use the method ads.analytic.material.get

                                                                                                                                                               
Parameters Value Additional attributes
material_id material id int (numeric value), required parameter
period Method for grouping data by date:            

1. day - statistics by day;

           

2. month - statistics by months;

           

Temporary restrictions are set by date_from and date_to parameters

       
required parameter, string
date_from The starting date of the displayed statistics. Different date format is used for different values ​​of the period parameter:            

1. day: YYYY-MM-DD, Example: 2011-09-27

           

2. month: YYYY-MM, example: 2011-09

       
required parameter, string
date_to End date of output statistics. Different date format is used for different values ​​of the period parameter:            

1. day: YYYY-MM-DD, Example: 2011-09-27

           

2. month: YYYY-MM, example: 2011-09

       
required parameter, string

Result:
Returns an object with data

{
response: {
count:% total items%
items: {
date
shows
clicks
ctr
cpm
money
                       }
                  }
}

Creating an advertising campaign

To create a new advertising campaign, use the ads.campaigns.put
method The number of campaigns created with a single request is 50.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
Parameters Value Additional attributes
data </​​td>         a serialized JSON array of objects describing the campaigns being created. See the client_specification object description below. required parameter, string
client_specification
app_id user id required parameter, int (numeric value)
client_id id of the client in whose advertising account the campaign will be created. It can also take the value app_id (itself)         required parameter, int (numeric value)
ad_format Ad Format:            

10 - Teaser;

           

20 - Banner;

           

30 - Push Notifications;

           

40 - Clickunder;

           

60 - Contextual

       
required parameter, int (numeric value)
cost_type Payment method:            

0 - CPC;

           

1 - CPA;

           

2 - CPM

       
required parameter, int (numeric value)
name campaign name         required parameter, string
Link_url link to the advertised object in the format: http: //yoursite.cоm         required parameter, string
real_url link to the real domain of the advertised object in the format: http: //yoursite.cоm         required parameter, string
sex Gender:            

3 - any;

           

2 - male;

           

1 - female

       
required parameter, int (numeric value)
age The age of the target audience. Age category number from 1 to 6 (up to 17, 18-25, 26-34, 35-49, 50-60, over 61) required parameter, a sequence of numbers separated by a comma
regions Regions, from 1 to 10 (1 - Russia, 2 - Ukraine, etc.) required parameter, a sequence of numbers separated by a comma
cpa_mode Type of conversion notifications for CPA: /ads.targeting.modes.get int (numeric value), mandatory for CPA campaigns
categories

category IDs:

           

/data.categories.get?ad_format =%

           

       

array [category_id => cost]

tags keyword targeting

required parameter, a sequence of keywords separated by a comma: [“key1”, “key2”, .., “keyN”]

           

Keywords with price. Only for payment - for clicks or for views: {“key1”: “cost”, “key2”: “cost”, .., “keyN”: “cost”}

           

cost - float

           

example: "data [tags] [qwerty]: 1" is the qwerty keyword with a 1rub rate.

       
day_limit Daily limit in rubles. For all types except clickunder positive number
all_limit Total limit in rubles. For all types except clickunder positive number
click_limit Maximum count. transitions per day. For all types except clickunder. For views and clicks. positive number
conversion_limit Maximum count. conversions per day. For all types except clickunder. Only for CPA positive number
adult_content presence of adult content in the advertising campaign:            

0 - No;

           

1 - Yes

       
optional parameter, int (numeric value), default 0
adult_site Display campaign ads on adult content sites:            

0 - No;

           

1 - Yes

       
optional parameter, int (numeric value), default 0
time_show Time Targeting:            

& nbsp; & nbsp; * - display in any hours and days of the week

           

& nbsp; & nbsp; {} is an array, where the key is the name of the day of the week ["Sn", "Mn", "Tu", "Wd", "Th", "Fr", "Sa"]:

           

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: ‘*’ - all watches are weekly

           

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: [0, .., 23] - hours, separated by commas

       
optional parameter, * default
platforms platform targeting: /data.platforms comma separated numbers
browsers browser targeting: /data.browsers comma separated numbers
black_list black list of sites where ads will not be shown comma separated site ID number sequence
white_list white list of sites where ads will not be shown comma separated site ID number sequence
black_list_ip ip lock sequence of ip addresses separated by a comma or an array
unique_day_count frequency of material shown to one user (times) positive number
unique_days frequency of advertising material shown to one user (days) positive number

Result:
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the id of the created campaign, and the error_code and error_desc fields in case of an error.

Errors:

 102 - unknown client
   103 - overlimit campaigns 

Editing ad campaigns

To edit ad campaigns, use the ads.campaigns.update
method The maximum number of campaigns edited with a single query is 50.
Version log: 1.0.1 - added status parameter

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
Parameters Value Additional attributes
data </​​td>         is a serialized JSON array of objects describing changes in campaigns. Object descriptions client_mod_specification see below. required parameter, string
client_specification
campaign_id id of the edited campaign         required parameter, positive number
name campaign name optional parameter, a string between 3 and 60 characters
link_url link to the advertised object in the format http: //yoursite.com optional parameter, string
real_url link to the real domain of the advertised object in the format: http: //yoursite.cоm         optional parameter, string
sex Gender:            

3 - any;

           

2 - male;

           

1 - female

       
optional parameter, int (numeric value)
age age: /data.ages optional parameter, int (numeric value)
categories category IDs:            

/data.categories.get?ad_format =%

           

category_id: {region_id: cost}

       
optional parameter
tags keyword targeting optional parameter, comma separated keyword sequence
day_limit daily limit in rubles. for all types except clickunder optional parameter, positive number
adult_content presence of adult content in the advertising campaign:            

0 - No;

           

1 - Yes

       
optional parameter, int (numeric value), default 0
adult_site display campaign ads on adult content sites:            

0 - No;

           

1 - Yes

       
optional parameter, int (numeric value), default 0
time_show Time Targeting:            

& nbsp; & nbsp; * - display in any hours and days of the week

           

& nbsp; & nbsp; {} is an array, where the key is the name of the day of the week ["Sn", "Mn", "Tu", "Wd", "Th", "Fr", "Sa"]:

           

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: ‘*’ - all watches are weekly

           

& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; {} - ‘mn’: [0, .., 23] - hours, separated by commas

       
optional parameter, * default
platforms platform targeting: /data.platforms comma separated numbers
browsers browser targeting: /data.browsers comma separated numbers
black_list black list of sites where ads will not be shown comma separated site ID number sequence
white_list white list of sites where ads will not be shown comma separated site ID number sequence
black_list_ip ip lock sequence of ip addresses separated by a comma or an array
status start /pause campaign:            

0 - suspended;

           

1 - running

       
optional parameter, int (numeric value), default 1

Result:
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.

Errors:

 100 - unknown campaign
    102 - unknown client 

List of campaign advertising campaign

To get a list of campaign advertising campaigns use the method ads.campaigns.get

                                                                                                                                                                                                                                                               
Parameters Value Additional attributes
client_id Client ID from which ad campaigns are requested int (numeric value)
include_archive A flag that specifies whether to display archived ads:            

0 - show only active campaigns;

           

1 - show all campaigns

       
Flag, can be 1 or 0
campaign_ids Filter for displayed ad campaigns.            

Serialized JSON array containing campaign id. Only campaigns that are present in the campaign_ids and are campaigns of the specified advertising cabinet will be displayed. If the parameter is null, then all campaigns will be displayed.

       
String
with_bwlist Black and white list transfer flag any value (for example 1)
with_tags Keyword Transfer Flag any value (for example 1)
limit limit on the number of campaigns returned. Used only if the campaign_ids parameter is null int (numeric value)
offset offset. Used in the same cases as the limit parameter int (numeric value)

Result:
Returns an array of campaign objects, each of which contains the following fields:

response: {
       count:% total%
       items: [{
id - campaign identifier
name - campaign name
status - campaign status (0 - campaign stopped, 1 - campaign started, 2 - campaign deleted)
day_limit - campaign daily limit in rubles (0 - no limit is set)
all_limit - total campaign limit in rubles (0 - no limit is set)
ad_format - ad format
cost_type - payment type
link_url - link to the advertised object
sex
age - age
regions - region identifiers
categories - category identifiers.
adult_content - the presence of adult content
adult_site - display campaign ads on adult content sites
           tags - keywords
           bw_list - black and white list
      }, ..]
}

Errors:

 102 - unknown client 

Archiving an advertising campaign

To archive an advertising campaign, use the ads.campaigns.delete
method The maximum number of clients edited with a single query is 10.

                                                               
Parameters Value Additional attributes
ids Campaign id list separated by comma or array with id campaigns.           

For example:

          

“id1, id2, ..., idn“ or [id1, id2, ..., idn]

       
required parameter, string

Result:
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.

Errors:

 100 - unknown campaign
   101 - campaign already archive
   102 - unknown client 

Receiving codes for CPA campaigns

Use the ads.campaigns.cpa.mode.get
method to get the codes for the CPA campaigns

                                                               
Parameters Value Additional attributes
campaign_id campaign id int (numeric value), required parameter

Result:
Returns an object with data.

{
response: {
url:% url%
                  }
}

Getting a list of categories for a given filter

To return the list of categories for a given filter, use the ads.campaigns.categories.get
method

                                                                                               
Parameters Value Additional attributes
ad_format ad format:             

ads.campaigns.foarmats.get

       
required parameter, int (numeric value)
category_id category id. limits displaying only by category id optional parameter, int (numeric value)

Result:
Returns an array of responses to queries in the response array.

response: {
            count:% total%
            items: [{
                       % category_id%: {
                            % region_id%: {
min:% min_cost%
max:% max_cost%
                             }
                       }
                  }, ..]
}

Getting the list of ad formats

Use the ads.campaigns.formats.get
method to get the list of ad formats.

Result:
Returns an array of responses to queries in the response array.

response: {
       count:% total%
       items: [{
             id:% format_id%
             title: ‘% format title%’
       }, ..]
}

Getting the list of platforms

For a list of platforms, use the ads.targeting.platforms.get
method

Result:
Returns an array of responses to queries in the response array.

response: {
       count:%
       items: [{
           id:% platform_id%
           title:% platform_name%,
           mobile:% is mobile%
       }, ..]
}

Getting Browser List

For a list of browsers, use the ads.targeting.browsers.get
method

Result:
Returns an array of responses to queries in the response array.

response: {
       count:%
       items: [{
           id:% browser_id%,
           title:% browser_name%,
       }, ..]
}

Getting a list of conversion notifications for the CPA

To get a list of conversion notifications for CPA, use the ads.targeting.cpa.modes.get
method

Result:
Returns an array of responses to queries in the response array.

response: {
       count:% total%
       items: [{
           id:% mode_id%
           title: ‘% mode title%’
       }, ..]
}

Getting a list of ages

To get the list of views, use the ads.targeting.ages.get
method

Result:
Returns an array of responses to queries in the response array.

response: {
       count:%
       items: [{
           id:% age_id%
           title:% age_name%
       }, ..]
}

Creating advertising agency clients

To create ad agency clients, use the ads.clients.put method
The allowable number of clients created with a single request is 50.

                                                                                                                                       
Parameters Value Additional attributes
data </​​td>         a serialized JSON array of objects describing the campaigns being created. See the client_specification object description below. required parameter, string
client_specification
name client name string from 3 to 60 characters, required parameter
day_limit daily limit in rubles int (numeric value)

Result:
Returns an array of responses to queries in the data array. The corresponding object in the output array contains the client information or the error array in case of an error (for each client separately).

{
    client_id - client identifier;
    name - the name of the client;
    day_limit - client's daily limit in rubles;
}

Editing advertising agency clients

To edit ad agency clients, use the ads.clients.update method
The maximum number of clients edited with a single query is 50.

                                                                                                                                                                       
Parameters Value Additional attributes
data </​​td>         is a serialized JSON array of objects describing changes in clients. Description of client_mod_specification objects see below. required parameter, string
client_mod_specification
client_id ID of the client being edited required parameter, positive number
name client name a string between 3 and 60 characters
day_limit daily limit in rubles positive number

Result:
Returns an array of responses to each request in the data array. The corresponding object in the output array contains the id of the client being changed and, in case of an error, the error_code and error_desc fields.

Getting a list of advertising agency clients

To return the list of clients of an advertising agency, use the ads.clients.get method

                                                               
Parameters Value Additional attributes
client_ids A list of client ids separated by commas. For example: “id1, id2, ..., idn“ optional parameter, string

Result:
Returns an array of client objects of the agency, each of which contains the following fields:

response: {
      count:% total%
      items: [{
           client_id - client identifier;
           name - the name of the client;
           day_limit - client's daily limit in rubles;
           balance - client's balance
      }, ..]
}

Archiving advertising agency clients

For archiving ad agency clients, use the ads.clients.delete method

                                                               
Parameters Value Additional attributes
ids List of clients' id by comma or array with id clients.             

For example: “id1, id2, ..., idn“ or [id1, id2, ..., idn]

      
required parameter, string

Result:
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.

Tying a client to an advertising agency

To bind a client to an advertising agency, use the ads.clients.bind.put method

                                                                                               
Parameters Value Additional attributes
email client email address string from 3 to 60 characters, required parameter
password client password (from account) string from 3 to 60 characters, required parameter

Result:
Returns:

{
“Bind”: true
}

in case of success. Or error in case of an error.

Detaching a client from an advertising agency

To detach a client from an advertising agency, use the ads.clients.unbind.put method

                                                               
Parameters Value Additional attributes
client_id client id int (numeric value)

Result:
Returns:

{
“Unbind”: true
}

in case of success. Or error in case of an error.

Customer account replenishment

To replenish the client’s account, use the ads.clients.balance.put method

                                                                                                                                                               
Parameters Value Additional attributes
client_id customer id to replenish int (numeric value), required parameter
sum rubles in rubles int (numeric value)
back_url url where the recharge system forwards the client string (string)
system_id replenishment system id:              

data.balance.systems.get

       
int (numeric value), required parameter

Result:
Returns the url for payment:

{
response: {
url:% url%
                  }
}

Creating advertisements

To create ads using the method ads.materials.put
The maximum allowable number of ads generated by a single request is 20.

                                                                                                                                                                                                                                                                                               
Parameters Value Additional attributes
data </​​td>         is a serialized JSON array of objects describing the created ads. The description of ad_specification objects is given below. required parameter, string
ad_specification
campaign_id id of the campaign in which the ad will be created required parameter, int (numeric value)
title ad title required parameter
text ad description Required
link_url link of the advertised object in the format: http: //yoursite.com
link_media previously loaded media object (jpg, gif):               

data.upload.media

       
pause_after_moderate pause posting moderation
size for banners only:               

ads.materials.banner.sizes

       
categories Stacks by category, similar to campaigns:          

array [category_id => cost]

       
Not required if you do not set bids from campaign categories

Update ad data

Use the ads.materials.update
method to update ad data. The maximum allowable number of ads generated by a single request is 20.

                                                                                                                                       
Parameters Value Additional attributes
data </​​td>         is a serialized JSON array of objects describing the created ads. The ad_specification object description is below. required parameter, string
ad_specification
material_id ad id required parameter, int (numeric value)
status start /pause material:            

0 - suspended;

           

1 - running

       
optional parameter, int (numeric value), default 1

Archiving advertisements

For advertising ads using the method ads.materials.delete
The maximum number of clients edited with a single query is 50.

                                                                                               
Parameters Value Additional attributes
account_id advertising account ID required parameter, int (numeric value)
ids serialized JSON array containing ad IDs required parameter, string

Result:
Returns an array of responses to each request. Each answer is either 0, which means successful deletion, or an error array.

Getting a list of advertisements

Use the ads.materials.get method to get the list of ads.

                                                                                                                                                                                                                                                                                               
Parameters Value Additional attributes
account_id advertising account ID required parameter, int (numeric value)
client_id For advertising agencies. Client ID from which advertisements are requested. int (numeric value)
archive A flag that specifies whether to display archived ads:            

0 - display only active ads;

           

1 - display all ads

       
Flag, can be 1 or 0
campaign_ids ad campaign filter.              

Serialized JSON array containing campaign id. If the parameter is null, advertisements of all campaigns will be displayed.

       
string
material_ids ad campaign filter.              

Serialized JSON array containing ad id. If the parameter is null, all advertisements will be displayed.

       
string
limit limit on the number of ads returned. Used only if the ad_ids parameter is null, and the campaign_ids parameter contains the id of only one campaign.         int (numeric value)
offset offset. Used in the same cases as the limit parameter int (numeric value)
ad_format ad format: ads.campaigns.formats.get required parameter, int (numeric value)

Result:
Returns an array of ad objects, each of which contains the following fields:

  
           
  • id - ad id
  •        
  • name - the name of the ad
  •        
  • campaign_id - Campaign ID
  •        
  • link_url
  •        
  • arhive
  •        
  • ad_format - ad format
  •        
  • cost_type - payment type
  •        
  • all_limit - total ad limit in rubles
  •             
                             
    • 0 - no limit is set
    •             
           
  • status - ad status:
  •             
                             
    • 0 - ad stopped;
    •                        
    • 1 - the ad is running;
    •                        
    • 2 - ad deleted
    •             
           
  • approved - ad moderation status:
  •             
                             
    • 0 - the ad is awaiting moderation;
    •                        
    • 10 - Ad has been approved.
    •                        
    • 20 - ad disapproved
    •             
      

Getting a list of banner sizes

For a list of banner sizes, use the ads.materials.banner.sizes.get
method

Result:
Returns an array of responses to requests in the response array:

response: {
        count:% total%
        items: [{
             id:% banner_id%,
             title: ‘% banner title%’
        }, ..]
}

Getting the list of countries

To get the list of countries, use the data.geo.countries.get
method

Result:
Returns an array of responses to requests in the response array:

response: {
    count:%
    items: [{
        id:% country_id%,
        title:% country_name%
    }, ..]
}

Getting a list of regions for a given filter

To get a list of regions for a given filter, use the data.geo.regions.get
method

                                                               
Parameters Value Additional attributes
country_id country identifier obtained in the ads.geo.countries method positive number, required parameter

Result:
Returns an array of responses to requests in the response array:

response: {
        count:%
        items: [{
               id:% region_id%
               title:% region_name%
        }, ..]
}

Get a list of available payment systems

To get a list of available payment systems, use the data.balance.systems.get
method

Result:
Returns an array of responses to requests in the response array:

response: {
         count:% total%
         items: [{
                id:% pay_system_id%,
                title: pay% pay system title% ’
         }, ..]
}

Download media files

To upload media files (jpg, png, gif), use the data.upload.media.update
method

                                                                                       
Parameters Value Additional attributes
ad_format ad format: /ads.formats.get int (numeric value)
file CURLFile object

Result:
Returns an array with a reference to the target object or error in case of an error.

response: {
        image: “% link%”
}

An example of sending a file using curl in php:

       $ token = ‘received token’;
       $ ad_format = объявления ad format ’;
       $ app_id = ‘your app id’;
       $ file = '@ /full path to file';
       $ finfo = finfo_open (FILEINFO_MIME_TYPE);
       $ finfo = finfo_file ($ finfo, $ link);
       $ cFile = new \ CURLFile ($ link, $ finfo, basename ($ link));
       $ post = array ('file' => $ cFile, 'ad_format' => $ ad_format, 'app_id' => $ app_id);
       $ ignoreParams = array ('file'); //file field is not involved in the construction of the signature
       ksort ($ post);
       $ result = array ();
       foreach ($ post as $ key => $ value) {
         if (false == in_array ($ key, $ ignoreParams)) {
$ result [] = $ key. '='. urlencode ($ value);
}
       }
       $ result = implode ('&', $ result);
       $ signature = md5 ($ result. $ token);
       $ target_url = 'http://api.kadam.net/data.upload.media?signature='. $ signature;
       $ ch = curl_init ();
       curl_setopt ($ ch, CURLOPT_URL, $ target_url);
       curl_setopt ($ ch, CURLOPT_POST, true);
       curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post);
       curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1);
       $ result = curl_exec ($ ch); //server response

Get the current server time

To get the current server time in ISO 8601 format, use the server.time.get
method

Result:
Returns an array of responses to requests in the response array:

        {
            iso8601:% time%
        }

Statistics for Webmasters

For statistics on webmasters use the method webmaster.reports.report.get

                                                                                                                               
Parameters Value Additional attributes
secret Access key for webmasters (mandatory) Available on demand
date_from Start of Period a string of the form "YYYY-MM-DD" is an optional parameter; if absent, the current date will be taken
date_to End of Period a string of the form "YYYY-MM-DD" is an optional parameter; if absent, the current date will be taken

Maximum unloading period 1 month
Result:

  
           
  • blockviews - Block Views
  •        
  • moneyin - Earned money

Returns data as

Array
(
    [responce] => Array
        (
            [2017-11-10] => Array
                (
                    [blockviews] => 300
                    [moneyin] => 100.00
                )

        )

)

Money transfer for subsidiary accounts of the agency

To transfer money, use the ads.clients.balance.update method

                                                                                                                                                           
Parameters Value Additional attributes
client_id Customer ID, money will be transferred to it. Required
sum transfer amount Required
type Operation Type Required - always type = "transfer"
comment Comment Required - null value allowed

The operation can be performed only if there are sufficient funds on the account
Money will be withdrawn from the user specified in the app_id
Result:
The result of the operation will be the withdrawal of funds from the primary user - an output transaction. And the transfer of money to the agency account is an input transaction.

Returns data as

Array
(
    [status] => "success"

)

In case of error - error code