API – Paginating Results
This article assumes you have read API – Responses with multiple results.
When dealing with requests that return multiple results, many times you only want a subset of results. Other times, you have more results than the default pagination settings allow you to see. This article will cover pagination settings for the LoanPro API.
The default pagination settings return up to the top 50 elements for almost all queries. This limits bandwidth and lowers response times, while still giving an abundant amount of information. This means that the summary field will have the following values:
- start: 0
- pageSize: 50
At times you will want to $skip the first 20 or 50 or 1,000 items. To do this, you use the GET parameter $skip. The $skip parameter tells LoanPro which result to skip to when fetching results. This means that to get the 20th item and onward you will have the GET parameter of $skip=20. For getting the 50th item and onward it would be $skip=50, and so forth.
However, if you are using a search endpoint (such as Loans/Autopal.Search()) you will need to use the $start variable instead of the $skip variable. The $start variable has the same usage as the $skip variable – the only difference is the variable name.
Setting Page Size
To set page size, you use the $top variable. This sets the maximum page size. Please note that this does not guarantee that, that many items will be returned, even if there are more items than the maximum page size. It does guarantee that no more than the number provided will be returned. This means that if you set $top=10, no more than 10 items will be returned. This does NOT change the order that items will be returned.
Turn Off Paging
To turn off paging, send “nopaging” as a GET parameter (note that this parameter does not have a value). This turns off the maximum number of items that can be returned, but does not change the pageSize value in summary.
Please note that this feature is currently not available for search endpoints, such as Loans/Autopal.Search().