Limit-offset pagination method
Overview
This method is similar to the page number parameter approach. However, instead of appending a page number to the request URL, an offset parameter is used to indicate how many results have been returned so far (i.e. the start point for required data).
This method is rather like a database search: give me 5 records starting from the 15th record.
Limit-offset options
Example
Suppose we set the following options:
...and we send a request to get the first page of data:
The response will include the first page of data (sometimes with metadata regarding pagination). For example:
Requests for subsequent pages would increment the offset
value by the limit
value - for example:
...and then:
...and so on until 50 items (i.e. the total parameter path value
) are returned.
When does pagination stop?
Pagination continues until the last page, when there is no more data to return.
Special notes
The limit offset pagination method is implemented using a Patchworks pagination variable which contains the next page offset:
This note is for reference only - there should never be a need to access/change this variable.
Last updated