Pagination and Sorting

A StackHawk organization may have many applications, which may have many environments, that can group many scan results, that may each report many scan alerts.

Requests made to the StackHawk API for listed resources will return paginated results.

Pagination and Sorting

Paginated requests follow a pattern of taking the following optional path parameters:

  • pageToken: a number incrementing count of pages in the pagination, starting from 0.
  • pageSize: the number of elements to request in the page, defaults to 10, and cannot exceed 1000.
  • sortField: sorts the listed resource by an approved field. Resources may have different supported sortFields with different defaults.
  • sortDir: either 'asc' or 'desc. Resources may sort in different directions by default.

The responseBody of these API routes will additionally include two fields:

  • nextPageToken: a string indicating the next pageToken to pass in for the next page of results with this request.
  • totalCount: the total number of resources the query can paginate through.

Best Practices

For optimal use of the StackHawk API, request resources with a small pageSize, and make subsequent requests with each nextPageToken as needed. API requests with a larger pageSize may take longer to process.