Re:Building APIs: A Comparison Between Cursor and Offset Pag...
by controlledchaos on Saturday April 17, 2021 @09:49AM
(#26844242)
When I’ve worked with APIs that implemented pagination using cursors (Square), I really loved the ease of integration with my app. Writing a while loop that checks if the cursor is populated was better/faster than checking if the number of results from the last request was less than the requested number of rows.
[ Parent
| on HN ]
Re:Building APIs: A Comparison Between Cursor and Offset Pag...
by tdeck on Saturday April 17, 2021 @02:41PM
(#26846421)
I actually built some of those Square APIs! The reason we used cursors was correctness. If new records get added (say, in your transaction history) and you're consuming records newest first, limit+offset pagination will cause the client to miss or double-count some records. That might be OK when a user is scrolling through a listing, but it's a real problem when you're writing an app to compute your sales tax obligation.