Pagination
Pagination makes sure that only a part (called page) of the resources is being returned during GET retrieval (listing). This is especially useful when a large amount of resources has been created. For example you may have created tens of thousands of rooms and it would be impractical to retrieve all of them in one GET request/response. That would put a huge strain on the bandwidth.
To paginate you need to use a combination of the following three parameters:
limit -> limits the number of returned records in the page. Maximum and default value is 100.
order -> determines the sorting order of the result. Ascending (asc) or descending (desc). Default value is "desc" = descending and the order is by the
creation time
of the records.after -> used as a cursor to browse through all pages. That is the id of the last record from the previous page. For examples read immediately below.
offset -> useful for table pagination where you want to retrieve records of a concrete page. The after param is on the contrary useful for infinite scroll type of pagination.
Pseudocode example how to paginate through all of your rooms
It loops using the after param as cursor until no more rooms are available.
Last updated