Pagination is used to save us the trouble of having to go through more number of records than necessary. It makes us easier to handle the results of any API calls that have been made. There are three common types of pagination that every API uses:
- Page and pageSize
- Limit and offset
- Cursor
We have standard means of paginating in each element.
Page and pageSize is our preferred method because it is easy to use and flexible. For this method, the page and pageSize need to be specified. page
being the particular page of results you'd like to look at, and pageSize
being the number of records that come up in that page.
Limit and offset, also known as Offset pagination is a method that makes use of the limit
and offset
commands. They work similar to the page
and pageSize
commands and therefore, can easily be converted to page and page size (pageSize = limit; page = offset/limit).
Cursor pagination is where you call GET /accounts
and it returns a nextPageToken
. This token is used on the next request to get the next page. It is not so easy to convert cursor based pagination to page and pageSize method of pagination.
Even though we want to use page/page size pagination across the board, it is not always possible. For this reason, you will find support for cursor based pagination everywhere in our platform. Every element supports cursor based pagination no matter what. That way, you can maintain consistency in your integrations. So, if you have an element that must be cursor based, you can use cursor based for every element.
Every GET /<anyObject>
returns the following header:
elements-next-page-token: eyJwYWdlU2l6ZSI6MiwicGFnZSI6Mn0
And on every one of these APIs, even if its not documented you can send the query parameter nextPage=eyJwYWdlU2l6ZSI6MiwicGFnZSI6Mn0
and it will work the same as if you had sent page
and pageSize
.
Paginator 3.0
Paginator 3.0 is the new, more enhanced version of Cloud Elements original paginator. Here is a comparison of the two for your better understanding.
Paginator | Paginator 3.0 |
---|---|
Requires more time to provide vendor responses. | Quicker vendor responses. |
Default pageSize set to 200. | Default set to 50 or the min/max Vendor pageSize. Default = min vendor pageSize,if Vendor min pageSIze > 50; Default = max vendor pageSize,if Vendor max pageSIze < 50 |
Maximum pageSize set to 2000. | Maximum pageSize set to 1000 orthe maximum vendor pageSize, whichever is lower. |
Makes multiple calls to the vendor if the Cloud Elements page size is greater than the vendor max page size. | Throws an error if pageSize entered < vendor min pageSize. Throws an error if pageSize entered > vendor max pageSize. |
Supports custom pageSize for Cursor pagination | Supports custom pageSize for Cursor pagination. |