API Pagination
API pagination with offsets and cursors: returning large results a page at a time without skipping rows or slowing down.
An API that lists orders, posts or customers cannot send them all at once, so it sends a page and lets the client ask for the next. There are two ways to say where the next page starts: an offset, which counts rows to skip, and a cursor, which names the last row seen. Each gets a worked example with its request and its SQL before a comparison sets them side by side. Two gotchas then show where offsets fail, one by skipping and repeating rows while the data changes and one by slowing down on deep pages, both from real runs. Practice chooses a strategy for a feed and for an admin report.
Contents
8 cardsnot started