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.
Option | Summary |
---|---|
Suppose we set the following options:
Option | Value |
---|---|
...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.
Pagination continues until the last page, when there is no more data to return.
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.
Limit parameter path
Enter the dot notation path for the data element in your response which contains the maximum number of items that the API should return in a single page of a paginated response. Commonly (though not necessarily), this would be a path to a limit
field.
Offset parameter path
Enter the dot notation path for the data element in your response which contains the required offset - i.e. how many items should be skipped before the next page starts. Commonly (though not necessarily), this would be a path to a page
field.
Limit
Enter the number of items to be returned per page. For example: 10
.
Count parameter path
If required, enter the dot notation path for the data element in your response which contains the current count of records that have come back from the system. Commonly (though not necessarily), this would be a path to a count
field. This value is not required for some APIs, therefore it's an optional field.
Total parameter path
Enter the dot notation path for the data element in your response which contains the total number of records that will be returned in this response, so we know when to stop paginating. Commonly (though not necessarily), this would be a path to a total
field. This value is not required for some APIs, therefore it's an optional field.
Limit parameter path
limit
Offset parameter path
offset
Limit
5
Count parameter path
meta.count
Total parameter path
meta.total