Pearson
Always Learning

If an API call returns a large array of data, you may want to request only a piece of that data at a time. For example, for a mobile application, you may want to only request enough data to display on a screen, and when the user swipes to the next page, request the next portion of data. This is referred to as “paging”, and some resources provide offset and limit query parameters to support it. The offset parameter indicates what index in the array to begin the data set to return, and the limit parameter indicates how many datasets to return.

Although this implies a default sort order, this sort order is not meant to be a contract and is subject to change. For example, if new data was inserted or a data item was deleted between requests, the sort order might change between requests for data. Thus, if you repeat the request using the same offset and limit parameters, the response may differ between requests because different data may be in those positions. This means that you should not store a value for the offset parameter to use to access a particular data item, since the order may change.

Note that not all APIs support pagination. Refer to the specific reference documentation for each API.

1761 reads
Always Learning
Pearson