Pagination
- Table of Contents
- Request Parameters
- Response
- Usage
- Example Response with page
- Example Response with page_token
Most API endpoints with lists of records will include the following standardized pagination system.
Request Parameters
| per_page integer | The number of records per page. Defaults to  | 
| page integer | The current page number (see below). Defaults to  
 | 
| page_token string | The page token to retrieve. 
 | 
Response
The response will also contain the following extra keys:
| per_page integer | The number of records per page | 
| num_records integer | The total number of records that match the query | 
| num_pages integer | The total number of pages that match the query | 
| page integer | The current page number | 
| page_token string | The page token supplied for this page. | 
| next_page_token string | The next page token to retrieve. | 
Usage
There are two ways to page through the data:
- 
    Sequentially increment pageto specify additional page numbers until you have retrieved every page of the results. When records are added or removed the page boundaries may shift, and it’s possible that some records will be missed between pages or returned on two adjacent pages.
- 
    Provide in page_tokenthenext_page_tokenvalue returned by the most recent call to this API which got the previous page. This guarantees that the next returned page will start immediately after the previous page, with all pages being contiguous and non-overlapping. When anext_page_tokenof null is returned, that indicates that this is the last page.
If you are presenting a list of pages to the user, you probably want to use
page. If you want to retrieve all of the data, page_token is likely what you want.
(When retrieving all data, the page_token method allows GreenArrow to more efficiently
provide the data.)
Both page and page_token may not be specified in the same request.
Example Response with page
{
  "data": [ {}, {}, {}, {} ],
  "page": 0,
  "per_page": 100,
  "num_records": 4,
  "num_pages": 1
}
Example Response with page_token
{
  "data": [ {}, {}, {}, {} ],
  "next_page_token": "YjMmVjZzImY5QWfiQWaiojI5J2XyVGZy9mIsUTM6ICZpJye",
  "page_token": "IWM1IDMiFWZ1MWfiQWaiojI5J2XyVGZy9mIsMTM6ICZpJye",
  "per_page": 2,
  "num_records": 4,
  "num_pages": 2
}
