Querying Collections
A collection endpoint like GET /articles can return ten rows or ten million. Returning them all is never the answer. Four query capabilities turn a raw list into something clients can use efficiently.
The four levers
Section titled “The four levers”flowchart LR C[GET /articles] --> P[Pagination: how many, which slice] C --> F[Filtering: which rows] C --> S[Sorting: what order] C --> Fl[Field selection: which fields]
All four live in the query string, because they describe which view of the collection you want — not which resource. Identity stays in the path; the query shapes the result.
What this module covers
Section titled “What this module covers”- Pagination — offset vs cursor, and the response envelope.
- Filtering & sorting — selecting and ordering rows.
- Field selection — sparse fieldsets and expanding relations.
- Search & envelopes — full-text search and a consistent wrapper.