Pagination
Pagination splits an API result list into retrievable pages. Ordering, continuation and changes during retrieval belong in the API contract.
Pagination divides a result list into separately retrievable pages. An API therefore does not have to send every record in one response. Page size, ordering, continuation and the way clients recognise the end of the list belong in the interface contract.
In a fictional example, a list sorted by identifier initially contains A, B, C, D. The first page returns A and B. Before the next request, AA is inserted between those entries. If an offset-based method now skips the first two current records, the next page starts at B again: one record appears twice. A unique ordering does not by itself freeze the data set.
Continuation needs explicit rules
A cursor can identify a continuation position, such as the position after the last returned record. Its exact meaning is defined by the API. A cursor does not automatically guarantee an unchanged snapshot; deletions and changes to sort values also need consideration.
In Google's token-based guidance, the continuation value is passed back unchanged rather than decoded by the client. Filters and other selection arguments stay the same; this contract allows the page size to change. The token does not replace an access check. A short or empty page does not establish the end of the list under this contract either: the absence of a continuation token does. Implement clients according to the documented contract of the API in use.
Sources
Related terms
- APIAn API defines how software can use functions or data offered by other software.
- RESTREST defines architectural constraints for distributed interfaces. Resources, stateless requests and links are part of the approach.
- OpenAPIOpenAPI describes HTTP interfaces in machine-readable form, including paths, parameters and responses. The description must match the running service.
- Server-sent eventsServer-sent events carry text notifications from server to client over HTTP, for example about the progress of a background job.
- Entity tagAn ETag identifies a particular representation version of an HTTP resource and supports conditional reads or changes.
- Cross-Origin Resource SharingCORS controls browser access to responses across origin boundaries. It replaces neither API login nor permission checks.
Your project with ASES
Describe your project to us. We will get back to you with an initial assessment.