pagination
Splitting a large collection into bounded pages, each with a way to ask for the next one.
In more detail
Every collection response needs a default and a maximum page size, so no request can return a whole table at once. The two common styles are offset pagination, which skips a count of items, and cursor or keyset pagination, which continues after the last item the reader saw. Each page must come from a stable sort on a unique key, or pages can overlap or skip items.
Examples
In the APIs course: The course contract suite walks every page and fails if any task appears twice or goes missing.Spring Data: Pageable and Page parameters on repository methods.Page size is caller input with a bound: the course caps a request for a million rows at one hundred.Related terms
- offset pagination — Paging by saying how many items to skip, such as ?limit=2&offset=4.
- cursor pagination — Paging by remembering the position of the last item seen and asking for items after it, such as ?after=2&limit=2.
- next link — The link a paginated response gives to the following page, which the client should follow exactly as supplied.
- pagination drift — A pagination bug where walking every page returns some items twice or misses some altogether.
- Entity Framework Core — Microsoft's object-relational mapper for .NET, which lets code query and save database data as C# objects and translates LINQ into SQL.
- options pattern — Binding a configuration section to a plain class with typed properties, validating it, and injecting it into services instead of reading raw strings.
- query parameter — A name and value added after the question mark in a URL, such as ?verbose=true, that refines a request.
- sort order — The rule that decides the order in which results are returned, such as newest first.
- unrestricted resource consumption — OWASP's name for APIs that let callers spend unlimited processor time, memory, connections, rows or money.
- keyset pagination — Paging by remembering the last key the reader saw and asking for rows after it, which does not drift.
- LIMIT — A clause that returns at most a given number of rows, optionally after skipping a number of rows with OFFSET.
- cursor — An opaque string returned with a page of results that you send back to get the next page.
- default type parameter — A type parameter with a fallback type, written <Data, Err = Error>, used when the caller does not supply one.
- metadata — Data that describes other data, such as a file name, a creation time or a package version.
Taught in
- HATEOAS And Hypermedia — Modern API Architecture: REST, GraphQL & gRPC
- Pagination Strategies — Modern API Architecture: REST, GraphQL & gRPC
- Sorting Results — Modern API Architecture: REST, GraphQL & gRPC
- Large Payloads And Streaming — Modern API Architecture: REST, GraphQL & gRPC
- Security Best Practices — Modern API Architecture: REST, GraphQL & gRPC
- The Options Pattern: Strongly Typed Configuration — Modern .NET Core, C# & Enterprise Microservices
- Querying, Change Tracking, and Saving Data — Modern .NET Core, C# & Enterprise Microservices
- Reading The Request — Modern Java: Virtual Threads & High-Throughput Services
- Spring Data Repositories — Modern Java: Virtual Threads & High-Throughput Services
- Rate Limiting And Resource Consumption — Application Security & Threat Modeling for Engineers
- Ordering And Limiting Results — PostgreSQL, Indexing & Relational Data Modeling
- Custom Type Predicates: Functions Returning is Type — Production TypeScript
- Default Generic Arguments And Multi-Type Parameters — Production TypeScript
- The Spine Artifact: Generating Typed Models From OpenAPI — Production TypeScript