API - Implementing Pagination
Note This topic applies to the following Advanced Browser Security APIs only: |
Retrieving full logs using pagination - pages of partial logs
Logs that are retrieved using the Advanced Browser Security APIs can be extremely long. Some Advanced Browser Security APIs therefore let you implement pagination - you can return logs that are composed of multiple pages of partial logs, that together combine to produce the full log. Each of these pages of partial logs is shorter and more manageable. This is achieved using a page token-based approach. With this approach, each page [partial log] that is returned by an API command contains two fields:
-
A portion of the total set of entries. The last page that is returned will contain no entries.
-
A token that points to the next portion of entries - nextPageToken.
If you include the limit parameter and the returned list includes more entries than are allowed by the limit parameter, then the returned results will have the following structure:
{
items: [
// Collection of device events
],
nextPageToken: “00112233445566778899aabb”
}
To return multiple pages of partial logs:
-
Use the relevant API call to return the first page of partial logs.
-
If the first page includes some entries, use the same API call to return the next page of partial logs. In this API call, set the pageToken query parameter to be equal to the nextPageToken that you received on the previous request to receive device events.
-
Repeat this process until the page that is returned includes an empty list of items, thereby indicating that there are no more pages of partial logs to return.
-
You can repeat the same API call to check if there are new entries.
The limit query parameter sets the maximum number of entries that can be included in each API call.
See also: