Reference: Paginated query syntax
Query pagination allows you to retrieve a portion of a records collection (a page) per query response, preserving system performance but enabling full record retrieval through multiple responses. You can adjust the number of records returned per page, and retrieve different pages in the collection.
For the best results, due to the variability in size of Tanium deployments, retrieve 100 records per page as an initial test of your paginated query, and adjust the number of records returned per page based on performance and response time.
When you submit a paginated query request, the API Gateway service assigns an opaque string that is valid for that query and collection (a cursor) to each record in the collection. Cursors generally persist for five minutes after the most recent use of any cursor in that collection.
For example, endpoints queries support pagination. If you submit an endpoints query request and receive a cursor in the response:
-
You can reference this cursor in a successive query of that records collection to retrieve pages of records before or after a given cursor. You can repeat this process to retrieve all pages in the collection.
-
You cannot reference this endpoints-associated cursor in a sensors query. The cursor is valid only for the endpoints collection.
- If you wait more than five minutes, then submit another endpoints query request referencing a cursor from the initial query request, the response returns an error because the cursors associated with your initial query are no longer valid.
Paginated queries generally support the following syntax:
-
<field>.edges - retrieve information about a record in the collection
-
<field>.pageInfo and <field>.totalRecords - retrieve information about pages and cursors in the collection, and collection total size
-
<field> (arguments) syntax to configure the number of records returned, and a cursor in the collection to determine which records to retrieve
A field might not support all of these fields and arguments. For more information on specific fields, see the Documentation Explorer pane of the query explorer.
Edges
Fields that support query pagination define an edge as a record within the collection. For each edge, you can retrieve the following fields:
-
<field>.edges.node - specific information about the object in that record
-
<field>.edges.cursor - the record cursor
Edge query syntax
Page information
Fields that support query pagination allow you to retrieve information about a page of records in the collection using the following fields:
-
<field>.pageInfo.endCursor - the last cursor in the current page
-
<field>.pageInfo.hasNextPage - whether there are pages after the current page in the collection
Fields that support query pagination might also support the following fields:
-
<field>.pageInfo.hasPreviousPage - whether there are pages before the current page in the collection
-
<field>.pageInfo.startCursor - the first cursor in the current page
- <field>.totalRecords - the total number of records in the collection
Page information query syntax
Paginated collection traversal arguments
Fields that support query pagination have arguments that control the number of records returned per page and which page is returned. If a query does not specify these arguments, the default settings generally return 20 records forward from the first page at the start of the collection.
Use the following arguments to traverse forward in a records collection:
-
<field> (after) - retrieve records after the specified cursor
-
<field> (first) - retrieve the first number of records after a cursor, or at the beginning of the collection if no cursor is specified
Use the following arguments to traverse backward in a records collection:
-
<field> (before) - retrieve records before the specified cursor
-
<field> (last) - retrieve the last number of records before a cursor
Forward traversal argument syntax
Backward traversal argument syntax
Paginated endpoints collection refresh argument
If you want to obtain updated information from an endpoints collection, such as if you expect endpoints to respond several minutes after your initial query request, you can refresh the collection. If your query request refreshes the collection, the API Gateway service updates collection results with current information, invalidates the prior set of cursors, and assigns new cursors to the records. The endpoints.collectionInfo field returns additional information about endpoints in the collection, including information about endpoints that responded to the query, and an endpoints.collectionInfo.startCursor cursor value. This value always points to the first cursor in the collection; you can reference this cursor value to refresh a collection.
Use the endpoints (refresh) argument to refresh an endpoints collection and the associated cursors.
Collection and cursor refresh argument syntax
Last updated: 9/12/2023 4:59 PM | Feedback