← REST API Development learning pathREST API Development · Module 7 of 10
Pagination, filtering and sorting
Return large lists efficiently.
📖 Key ideas
- Never return thousands of rows at once.
- Offset pagination: ?page=2&limit=20.
- Cursor pagination: ?after=abc123 (stable for changing data).
- Filter: ?status=active; sort: ?sort=-created_at.
- Return totals or next links in metadata.
💡 Real-life example: Pagination is reading a book page by page instead of photocopying the whole book at once.
Offset paginationSkip N rows then take M
Cursor paginationContinue after a marker
limitMax items per page
SortingOrdering results