Design paginated and filterable HTTP collection endpoints

8 steps · about 2 h 10 min · Intermediate

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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.