APIs that use offset-based paging use the
limit query parameters
to paginate through items in a collection.
Offset-based pagination is often used where the list of items is of a fixed and predetermined length.
To fetch the first page of entries in a collection the API needs to be called
either without the
offset parameter, or with the
offset set to
limit field is optional.
curl https://api.box.com/2.0/folders/0/items?offset=0&limit=100 \ -H "authorization: Bearer ACCESS_TOKEN"
To fetch the next page of entries the API needs to be called with
offset parameter that equals the sum of the previous
offset value and
limit returned in the previous result,
previous_offset + previous_limit.
curl https://api.box.com/2.0/folders/0/items?offset=100&limit=100 \ -H "authorization: Bearer ACCESS_TOKEN"
The final page of items has been requested when the next
offset value exceeds
total_count value in the response object. At this point there are no more
items to fetch.
Offset & Limit
The following query parameters are used to paginate a collection.
|Integer||The (zero-based) offset of the first item returned in the collection. In a zero-based offset |
|Integer||Depends on API||The maximum number of entries to return. If the value exceeds the maximum, then the maximum value will be used.|
When paginating collections, the API returns an object that contains the set of results as an array, as well as some information about the current page of results.
|Array||The page of items for this page. This will be an empty array if there are no results.|
|Integer||The offset used for this page of results|
|Integer||The limit used for this page of results. This will be the same as the |
|Integer||One greater than the offset of the last item in the entire collection. The total number of items in the collection may be less than |
Some endpoints that support offset-based pagination are: