Dear All,

This article is intended for customers, partners and anyone who have access to SAP Commissions to develop your solution by extracting all the JSON records using Commissions RestAPI.  In other words, to extract the data without commission database.

What Is Pagination?

Have you ever clicked through an Commission workspace with different pages? Or have you read through an extensive objects up into multiple segments? Do you know the numbers on the bottom of the webpage?

This how it looks at each workspace with more than 10 records have different pages..

That’s pagination.

Why pagination?

A lot of the time, when you’re making calls to the SAP Commissions REST API, there’ll be a lot of results to return. For that reason, product is built with paginate the results to make sure responses are easier to handle.

Let’s say your initial call is asking for all the pages in your commissions instance; the result could be a massive response with hundreds of thousands of JSON record pages. That’s not a good place to start and start downgrading the application slower due to heavy load..

Rather than that, SPM engineering team have built in a default limit on results, but we recommend you always explicitly set the top=100 parameter to ensure you know how many results per page you’ll get. Don’t rely on the defaults as they’ll be different depending on what parts of the response you’re expanding, so the response you get might not be what you expected.

Note :SAP Commission Rest API can provide max upto 1000 records with limit of &top=100

Some calls listed here support pagination, which are detailed in the individual sections listed here. Where pagination is available, the following fields are used:

Parameter Description Default Value
skip The subset of N elements skip from the Collection and selecting only the remaining elements (starting with Entry N+1) 0
top The first N number of element in the collection, where N is an integer greater than or equal to zero specified by this query option. The maximum allowed is 100 10
inlineCount The query option specifies that the response to the request includes a count of the number of elements. Values allowed: true or false false

For example:

  • https://{domain-name}/v2/positions?skip=0&top=15Return the first 15 results
  • https://{domain-name}/v2/positions?skip=15&top=5Return results from 16 to 20
  • https://{domain-name}/v2/positions?inlineCount=trueReturn results with total count

Example 1 :  /payments?skip=0&top=100  which will provide 100 records

Example 2 :  /payments?skip=300&top=100  which will provide another 100 records from different page

API Pagination: Summary and Best Practices

As APIs continue to get more involved and elaborate, API pagination is only going to become more essential. As we’ve shown, some APIs can return millions of search results, if not more. This can slow the response time of an API call down to a crawl.

To summarize, you’ve looked at what API pagination is, as well as some of the most common methods of implementation.

API pagination is essential if you’re dealing with a lot of data and endpoints. Pagination automatically implies adding order to the query result. The object ID is the default result, but results can be ordered in other ways as well.

Finally, we concluded with some above examples to give you some practical insights on how you use API pagination syntax.

 

API pagination is a vast topic. There’s a lot that can be said about it.


References

SAP Commissions – RestAPI filtering Parameter

SAP Commissions [Rest API] > Part 3 – API Documentation

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x