Usage of a paginated endpoint
A paginated endpoint is an endpoint that returns a subset of the data. To get the entire dataset, you need to make multiple requests to the endpoint, each time retrieving a different subset of the data. To do so, you need to use the limit
and offset
query parameters :
limit
: it controls the numbers of items returnedoffset
: it controls the number of items to skip before starting to collect the result set
Why use pagination?
✅ Better Performance – Prevents retrieving too much data at once.
✅ Improved API Efficiency – Reduces load on the server.
✅ Easier Navigation – Fetch data in smaller, manageable chunks.
Example API Requests
1️⃣ Retrieve the First 10 Snapshots
GET /snapshot?limit=10&offset=0
🔹 Returns snapshots 1 to 10.
2️⃣ Retrieve the Next 10 Snapshots
GET /snapshot?limit=10&offset=10
🔹 Skips the first 10 snapshots and returns 11 to 20.
3️⃣ Retrieve Snapshots 21 to 30
GET /snapshot?limit=10&offset=20
🔹 Skips the first 20 snapshots and returns 21 to 30.
Was this helpful?