Skip to main content

Work with Get[Something]Page Requests

In CRS, it is common to fetch entities using a paged API approach. This method allows clients to retrieve data in chunks (pages) rather than all at once.

Core Parameters

All paged requests use the following parameters:

  • offset: Index of the first entity in the current page (e.g., 0 for the first page).
  • count: Number of entities to retrieve per page.
  • includeOverallEntryCount (optional): If true, the response includes the total number of entities matching the filter and sort criteria.

To fetch all entities page-by-page using a filter:

  1. Define a page_size (e.g., 100).
  2. Send the first request with:
    • offset = 0
    • count = page_size
    • includeOverallEntryCount = true

This first response will include:

  • The first page_size entities in a field typically called entries
  • An overallEntryCount field representing the total number of matching entries
  1. For subsequent requests, continue with:
    • offset = page_number * page_size
    • count = page_size
    • includeOverallEntryCount = false

Example:

  • Request 2 → offset = 1 * page_size, count = page_size
  • Request 3 → offset = 2 * page_size, count = page_size
  • ... until all entries are fetched
tip

You should only set includeOverallEntryCount = true on the first request, as this value does not change between pages for the same filter. Calculating it repeatedly can be expensive and unnecessary.

This offset/count pattern is recommended whenever entities need to be fetched in pages - including products, actors, financial entries, etc.