Pagination¶
Most endpoints that return multiple objects are paginated.
For this reason, you might have to make more than one request to get all objects you are interested in.
Endpoints that require paging will include a nextPageToken
field in their response.
To get the next page, make the same request again,
but append a pageToken
query parameter containing the page token.
If there is no nextPageToken
field in the response, you are on the last page.
The page token may or may not change from one page to the next, and you must always use the page token from the latest page.
Page sizes¶
Optionally, you can set a maximum number of results per page using the pageSize
query parameter.
The default page size is the maximum page size allowed,
so this parameter should only be used to reduce the size of response pages.
pageSize is embedded in pageToken
A pageSize
parameter is not necessary when using a pageToken
query parameter,
as the page size is already included in the page token.
Example¶
The following code snippets show an example of paging across multiple requests.
First request¶
The first page of the request and the response will look like the following.
Not the presence of the nextPageToken
field indicating that there are more subsequent pages.
Request¶
Response¶
{
"nextPageToken": "1VWJHKcpg1jOmnlSn4pgDKsPKG2MRJ4cahEhp",
"data": [
{
"referenceId": "50040",
"firstName": "John",
"familyName": "Doe"
},
...
]
}
Second request¶
The second page request can be made by adding a pageToken
query parameter.