SAP Knowledge Base Article - Public

2489065 - OData API returns a certain amount of records in the response when more are expected

Symptom

You performed an OData API query and it fetched a certain amount of records, but you were expecting more results in the response payload.

Environment

  • SAP SuccessFactors HCM Suite
    • OData API

Cause

The API has a limit in the amount of records to be returned in the API response (up to 1000 only). When that limit is exceeded, it uses a mechanism called Pagination, which will make the response return the exceeding records in a subsequent page.

Resolution

By default, the max records returned in the response of OData API is 1000 per page. You are able to change that using the Custom Page Size parameter. If you perform an API query that exceeds the Page Size number, then the API will create more pages of results.

If you were expecting a specific record to be returned and it didn't return in the first page of the response, this may indicate that the record is actually in some other page of the response.

To get access to the subsequent pages and see the next set of records, you'll have to perform some actions that depend on the Pagination method being used:

For Client-Side Pagination

Refer to the KBA 2675265 - OData API: Using the $top and $skip parameters for pagination (Client-Side Pagination).

For Server-Side Pagination

Refer to Server-Side Pagination. When using this method, you need to use the Skiptoken which is located at the bottom of the response payload. It is a link similar to these ones below:

  1. On XML format:
    <link rel="next" href="https://apisalesdemo4.successfactors.com:443/odata/v2/User?$select=userId,status%20%20%20&amp;$skiptoken=eyJzdGFydFJvdyI6MTAwMCwiZW5kUm93IjoyMDAwfQ=="></link>

  2. On JSON format:
    "__next": "https://apisalesdemo4.successfactors.com:443/odata/v2/User?$select=userId,status&$format=json&$skiptoken=eyJzdGFydFJvdyI6MTAwMCwiZW5kUm93IjoyMDAwfQ=="

If you use the URL contained within the "__next" field, it will take you to the next page of records.

See Also

SAP SuccessFactors API Reference Guide (OData V2)

Keywords

1000, missing, sf, skip token, __next, next, pages, page, pagination, page size, pagesize, top, skip, $top, $skip, client-side, server-side, client side, server side , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HCM suite all versions