Pagination

Split the response into several pages. Available in all Adfox API versions. Pagination is used in all requests.

Request format

You can set up pagination using two parameters:

https://adfox.yandex.com/api/v1
  ? [offset=<integer>]
  & [limit=<integer>]

offset

Number of objects in the list to skip.

Default value: 0.

limit

Number of objects per page.

Default value: 10.

Maximum value: 1000.

Alert

Pagination is used in all requests. If the limit value isn't passed in the request, the default value of 10 is applied.

For example:

Request a list of all campaigns, with 25 campaigns per page.

https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=campaign&offset=0&limit=25

Request to view the second page with 25 campaigns:

https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=campaign&offset=25&limit=25

Response format

A pagination block has been added in the response to the request. It has information about the total number of pages, which page the response is currently on, the total number of objects, the number of objects on this page, and links to the first, previous, next, and last pages.

Sample pagination block in the response:

...
<links>
  <first>
  <![CDATA[
   https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=campaign&offset=0&limit=5
  ]]>
  </first>
  <prev>
  <![CDATA[
   https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=campaign&offset=0&limit=5
  ]]>
  </prev>
  <next>
  <![CDATA[
   https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=campaign&offset=10&limit=5
  ]]>
  </next>
  <last>
  <![CDATA[
   https://adfox.yandex.com/api/v1?object=account&action=list&actionObject=campaign&offset=80&limit=5
  ]]>
  </last>
<limit>5</limit>
<offset>5</offset>
<total_pages>17</total_pages>
<page>2</page>
<total_rows>85</total_rows>
<rows>5</rows>
</links>
...

Pagination block parameters

first

Link to the first page.

prev

Link to the previous page.

next

Link to the next page.

last

Link to the last page.

total_pages

Total number of pages.

page

Number of the current page.

total_rows

Total number of objects.

rows

Number of objects displayed on the page.

Number of objects in the list to skip.

Default value: 0.

Number of objects per page.

Default value: 10.

Maximum value: 1000.