Filtering and Sorting

Keyavi resources often return large amounts of data that you can filter to produce a specific subset of records. Keyavi APIs use query parameters to filter data in requests.

Query parameters are additional parameters that you add to the API endpoint URL. You can use query parameters to filter, sort, or limit the data returned. Add query parameters to the end of the endpoint URL after a question mark ?. This example filters log/payload resources to show only files with Audit actions.

Copy
curl --location 'https://<Custom API URL>/api/logs/payload?actionAttempted=Audit' \--header 'Authorization: Bearer <Your Token>'

You can add more filters by separating queries using an ampersand & to separate parameters, like in this example:

Copy
curl --location 'https://<Custom API URL>/api/logs/payload?actionAttempted=Audit&result=RevokeAccess' \--header 'Authorization: Bearer <Your Token>'

Filter options differ for each resource. See the Parameters section for specific resources in the API Reference.

Pagination

Keyavi resources that return large amounts of data support pagination to break down large amounts of data into smaller, more manageable chunks.

Keyavi APIs implement pagination through a JSON object called pagination. The pagination object contains the following properties:

  • totalRecords: The total number of records available in the dataset.

  • pageSize: The maximum number of records returned per page.

  • itemsInPage: The number of records returned on the current page.

  • page: The current page number.

You can request specific pages by passing the page number as a query parameter. This example returns page 5 from the full-payload resource.

Copy
curl --location 'https://<Custom API URL>/api/logs/full-payload?page=5' \--header 'Authorization: Bearer <Your Token>'