Design paginated and filterable HTTP collection endpoints
8 steps · about 2 h 10 min · Intermediate
- Shape a standard list method (reference, Google API Improvement Proposals, 15 min)
Start from a clear contract for list requests and responses before choosing a paging technique.
- Paginate with page tokens (reference, Google API Improvement Proposals, 15 min)
Learn why opaque tokens and a server-capped page size are safer to evolve than exposing raw offsets.
- Why deep offsets get slow (article, Use The Index, Luke, 15 min)
See what the database does for OFFSET 100000 and how keyset (seek) pagination avoids it.
- Follow Link headers as a client (doc, GitHub Docs, 15 min)
Use a large public API from the consumer side to feel what good paging looks like to callers.
- Web Linking and rel=next (reference, IETF RFC 8288, 15 min)
Read the sections on the Link header and relation types so your next and prev links follow the standard.
- Cursor pagination in a payments API (doc, Stripe Docs, 10 min)
Compare a different, well-known cursor design with starting_after and has_more flags.
- Add a small filtering language (reference, Google API Improvement Proposals, 20 min)
Define a filter syntax and its limits so clients can narrow results without you inventing one-off query parameters.
- Check your design against published API guidelines (guide, Zalando RESTful API Guidelines, 25 min)
Read the pagination and query parameter sections to catch naming and consistency issues before you ship.