Data retrieval with Paging¶
Backendless operations returning a collection of objects automatically break up the complete result set into pages. Backendless paging uses two parameters to enable paged data retrieval:
- page size - identifies how many objects a single page contains
- offset - identifies the position of the object from which to retrieve the number of records identified by
page size
The diagrams below illustrate the paging process. The first diagram shows the first request to retrieve a collection of records. The request includes the parameters of 5 objects in the page, starting from offset 0:
To retrieve the next page of data, the client must set the offset to the index of the first not retrieved object, which is 5:
Important
Backendless server sets the maximum allowed value for the page size to 100 objects. The minimum value is 1. Default page size is 10
Paging using the REST API is implemented with the pageSize
and offset
parameters in the data retrieval URL:
https://xxxx.backendless.app/api/data/<table-name>?pageSize=XX&offset=ZZ
pageSize
and offset
can be used with all other parameters supported by Backendless. Suppose a data table on the server contains 200 objects. To retrieve the first page of data with 100 objects in it, use the following request:
curl "https://xxxx.backendless.app[`/data/Person?pageSize=100`](/data/Person?pageSize=100)"
The following request can retrieve the next page (the remaining 100 objects):
curl "https://xxxx.backendless.app[`/data/Person?pageSize=100&offset=100`](/data/Person?pageSize=100&offset=100)"