SAP Knowledge Base Article - Public

2582815 - Implementing OData Pagination

Symptom

  • User need clarity on OData pagination concepts
  • User want to implement pagination in there system

Environment

OData API

Reproducing the Issue

User needs to implement pagination in there OData data set

Cause

Pagination is the process of dividing a OData data into discrete pages. User needs sytax to implement pagination

Resolution

Pagination:


The OData API provides simple pagination of query results. Pagination limits the maximum result size of a query response to 1000 records.

1. The OData standard provides a '__next' link in your query response if there are more results in the database.

2. The following example shows a URI whose response uses pagination:

     GET http://<hostname>/odata/v2/User?$format=json.

    Sample response:

              { "d" : { "results" : ................ "__next" : "http:// <hostname>/odata/v2/User? $format=json&$skiptoken=eyJzdGFydFJvdyI6NSwiZW5kUm93IjoxMH0%3D" } }

3. The $skiptoken option indicates the startRow and endRow of the Entity records for your next query. Copy the URL and access it to get the next 1000 records.

4.  Using the $top and $skip options together in a request URI creates a pagination query.

5. The response is a subset of the whole result, from $skip to $top. $skip indicates the starting row for the query. $top limits the size of the query.

               For example, if the URI uses $top=50, $skip=20, the response is a subset from numbers 21 to number 70 of the whole result set.

Keywords

Pagination, OData , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HCM Core all versions