Paging Results

Sometimes Telmetrics V3 API requests will return a large number of results. Rather than retrieve them all at once, which may affect your application’s performance, you can use paging to retrieve the results in batches. Often an application will show the first few results, and then only load the next batch of results when the user has taken an action, such as clicking a Next button or scrolling to the bottom of a list.

Paging is accomplished through two query parameters: "pagesize" and "pagenumber". Note that our page sizes are capped at 10000 records; in situations where the page size has been exceeded, you will either need to refine your search criteria to return fewer than 10000 results, or implement paging capabilities into your application.

The pagesize parameter will determine how many results will be returned in a page. If this value isn't passed, the pagesize will default to the maximum size for that collection.

The pagenumber parameter is used to page through the results from your request. If this value is not provided, it will default to page 1.

The following sample request is to the Calls resource. In this request, we are specifying that we want 10000 results to be returned per page.

curl -H "x-organization-token: {authorization_token}" \
     -X GET \
     "https://api.telmetrics.com/v3/api/calls?pagesize=100&pagenumber=1&startdateutc=2018-01-01-00:00&enddateutc=2018-01-02-00:00

In the resulting response, we can see that there are 895 results that match my query parameters. Based on this, I know that there are 9 pages of results that I will need to retrieve to collect my entire result set.

{
    "results": [
        {
           ...
        }
    ],
    "paging": {
        "pageNumber": 1,
        "pageSize": 100,
        "total": 895
    }
}