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): Iftrue, the response includes the total number of entities matching the filter and sort criteria.
Recommended Approach
To fetch all entities page-by-page using a filter:
- Define a
page_size(e.g., 100). - Send the first request with:
offset = 0count = page_sizeincludeOverallEntryCount = true
This first response will include:
- The first
page_sizeentities in a field typically calledentries - An
overallEntryCountfield representing the total number of matching entries
- For subsequent requests, continue with:
offset = page_number * page_sizecount = page_sizeincludeOverallEntryCount = 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.