For full API documentation and to download a sample Postman collection, please visit https://api.dragonmetrics.com/.

Often times when you make an API call, there may be hundreds, thousands, or even tens of thousands of results. To ensure the efficient performance of the API, there is a limit to the number of rows returned for each request. To access all available rows, you'll need to use the start and limit fields to page through the full data set.

This page will help you understand how to navigate paging in the Dragon Metrics API.

Limit

By default, all endpoints return a maximum of 50 results. Use the limit field in the request body to change this to your preferred value.

The maximum value for limit is 500. Requests with a limit greater than 500 will be returned with an error.

Example:

{
"campaign": "Test Campaign",
"begin_date": "01-08-2021",
"end_date": "07-08-2021",
"limit": 500
}

Start

Since the maximum value for limit is 500 results, the start field must be used to page through all results if there are more than 500 items.

The start field is the index of the first result in the set returned. The default for start is 0, which is the first item in the collection.

For example, to retrieve data from a collection that contains 1,000 results, two requests will be required. For the first request, set the limit to 500 and start of 0 to get items 0-499. To access the next page of results, leave limit to 500, but now set start to 500, which will return items 500-999.

Example:

{
"campaign": "Test Campaign",
"begin_date": "01-08-2021",
"end_date": "07-08-2021",
"start": 0,
"limit": 500
}

Paging Object

Every request contains a paging object, which helps make paging through results even easier.

This object shows the total number of items available in the set, and the value for start to get the next page, previous page, or the current page (assuming the same value for limit.

For example, if there are 2,000 total rows available, when using a limit of 500 when requesting the second page of results would look like the following:

"paging": {
"total": 2000,
"prev_start": 0,
"current_start": 500,
"next_start": 1000
}

Let's take a look at this in a bit more detail:

  • The first property, total, is the total number of results in the set

  • prev_start is the value for start to retrieve the previous page of results (assuming the same value for limit).

  • current_start is the value for start to retrieve the current page of results (assuming the same value for limit).

  • next_start is the value for start to retrieve the next page of results (assuming the same value for limit).

Did this answer your question?