Pagination & Filtering
Retrieve and process large collections of API resources efficiently.
APIs that return collections may support pagination, filtering, sorting, or search capabilities.
These mechanisms help applications retrieve relevant records without requesting an entire dataset at once.
The exact parameters and supported behavior depend on the API endpoint.
Pagination
Pagination divides a collection of results into smaller groups.
Common pagination approaches include:
Cursor-based pagination
Cursor-based pagination uses a continuation token or cursor to retrieve additional results.
An illustrative response might contain:
{
"data": [
{
"id": "example-resource-001"
}
],
"nextToken": "example-continuation-token"
}
The field names above are illustrative. They do not establish a universal Senmo API response format.
A client continues requesting pages until the documented response indicates that no additional results are available.
Offset-based pagination
Some APIs use an offset and page size to select a subset of results.
For example:
?limit=20&offset=40
These are common pagination parameters, not guaranteed InfraRails, Hyperhash, or Foundry parameters.
Filtering
Filtering allows applications to retrieve records matching specific conditions.
Possible filter categories include:
- Resource status.
- Creation date.
- Resource type.
- Currency.
- Environment.
- Associated identifiers.
Supported fields, operators, and combinations must be verified in the endpoint reference.
Sorting
Where supported, sorting controls the order in which results are returned.
Applications should not assume a default sort order unless it is explicitly documented.
Search
Search capabilities may support identifiers, names, references, or other indexed fields.
Search behavior, including case sensitivity and partial matching, is endpoint-specific.
Best practices
- Use pagination for potentially large collections.
- Avoid requesting more records than necessary.
- Preserve continuation tokens exactly as returned.
- Handle empty results correctly.
- Do not assume that page sizes are unlimited.
- Account for records changing while pagination is in progress.
- Use documented filtering rather than relying on client-side processing of entire datasets.
Next steps
Review Rate Limits & Retries for guidance on managing request volume and temporary failures.
Updated about 4 hours ago