List Pagination

Overview

You can paginate any List endpoint. Pagination means you can limit the number of total results.

Query Parameters

Parameter

Description

pageSize

how many results to return per page

page

the current page of the results

For example, this curl command returns the first page of 50 items per response:

curl -X GET -H 'X-Adzerk-ApiKey:<APIKEY>' -H 'Content-Type=application/json' https://api.kevel.co/v1/site?pageSize=50

This returns the second page of 25 items per response:

curl -X GET -H 'X-Adzerk-ApiKey:<APIKEY>' -H 'Content-Type=application/json' 'https://api.kevel.co/v1/site?pageSize=25&page=2'

Query Response

We will also return the totalPages and totalItems of the list.

{
  pageSize: 500,
  page: 1,
  totalPages: 1,
  totalItems: 4,
  items: [
    {
      .....
    }
  ]
}

🚧

"All The Things"

If you do not add pagination parameters, then the Management API will return all items in a single page. We strongly recommend pagination for lists over 500 items.

Note the JavaScript Management SDK, however, defaults to a page size of 500.

SDK Example

const Adzerk = require('@adzerk/management-sdk');
const apiKey = process.env.ADZERK_API_KEY;

async function listFlights() {
  let specifications = await Adzerk.fetchSpecifications();
  let client = await Adzerk.buildClient({apiKey, specifications, logger});

  let flights = await client.run("flight", "list", {pageSize: 500, page: 2});
  console.log(flights);
}

listFlights();