Certain endpoints in the API support cursor pagination. This guide will show how to make a paginated request and iterate through each page.

How to make a paginated request

You can make paginated requests using query parameters. The parameters enable pagination and determine how many results should be in each page.

Parameters

paginate - boolean. true to enable pagination. Default is false.
pageSize - int. The number of results on each page. Default is 150 and max is 500.

Iterating through pages

Responses will contain links to the next and previous page of results (if applicable). You can use those links to iterate through the pages.

The following properties will be included in the response body of a paginated request:

  • nextPageUrl - the url that can be used to get the next page of results (if there is a next page)
  • previousPageUrl - the url that can be used to get the previous page of results (if there is a previous page)

Supported endpoints

Example

This example will use pagination for the Detailed Returns List.

Request

GET https://api.loopreturns.com/api/v1/warehouse/return/list?paginate=true&pageSize=50&from=2022-01-01 00:00:00&to=2022-07-28 00:00:00

Response

{
  "returns": [...],
  "nextPageUrl": "https://api.loopreturns.com/api/v1/warehouse/return/list?to=2022-07-28%2000%3A00%3A00&filter=created_at&pageSize=5&cursor=eyJjcmVhdGVkX2F0IjoiMjAyMi0wNi0yNyAxNjoyNTowMSIsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0",
  "previousPageUrl": null
}

If there are no more pages of results, then the nextPageUrl will be null. If you are on the first page of results, then the previousPageUrl will be null.