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
We have standard means of paginating in each connector.
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
offset commands. They work similar to the
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 connector supports cursor based pagination no matter what. That way, you can maintain consistency in your integrations. So, if you have an connector that must be cursor based, you can use cursor based for every connector.
GET /<anyObject> returns the following header:
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
Paginator 3.0 is the new, more enhanced version of SAP Cloud Platform Open Connectors original paginator. Here is a comparison of the two for your better understanding.
|Requires more time to provide vendor responses.||Quicker vendor responses.|
|Default ||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 ||Maximum |
the maximum vendor pageSize, whichever is lower.
|Makes multiple calls to the vendor if the SAP Cloud Platform Open Connectors 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.|