Retrieving Data in Batches
Learn how to use limit and offset query parameters to control and paginate API requests efficiently.
Limit Query Parameter
The limit query parameter allows you to retrieve a specific number of results. For endpoints that support the limit query parameter, you can specify the number of results to retrieve. For example, if you only want to retrieve the first 10 available results, add ?limit=10
to the request URL:
Offset Query Parameter
The offset query parameter allows you to skip a specific number of results in the response. When a response contains many results, you can use the limit and offset query parameters together to break the response into pages.
For example, consider a job result response object that contains 5000 results. The Job Results API allows you to retrieve a maximum of 500 results per request. To retrieve all 5000 results, start by adding ?limit=500
to the request URL to retrieve the first 500 results:
In the next request, to retrieve the next 500 results (rows 501-1000), add &offset=500
to the request URL:
To retrieve the next 500 results (rows 1001-1500), increment the offset parameter to 1000 (&offset=1000
) in the next request:
Continue incrementing the offset parameter in requests until you have retrieved all 5000 results. Query with offset beyond available results will get a status OK response with empty ‘rows’ in it. Similar offset and limit parameters are applied in listing of athletes.