Symptom
When querying SuccessFactors data using OData API and $top parameter, the $top is not being respected.
For example, you are using $top=10 but the query is retrieving only 1 record, even existing more.
Environment
SAP SuccessFactors HCM Suite
Reproducing the Issue
This issue only occurs in a very specific scenario:
- Deep filtering is being used with one-to-many navigation between the entities involved (e.g. $filter=otherEntityNav/otherEntityField eq 'X');
- AND Client-side pagination is being applied on the top (e.g. $skip=100&$top=10);
Cause
This is a limitation of OData API for this specific scenario.
Resolution
There are two possible workarounds:
- Adapt you query to not use one of the mentioned conditions (deep filtering, one-to-many navigation, client-side pagination);
- OR Use server-side pagination, specifically the Snapshot-Based one, where all the pages are retrieved and then displayed (instructions in the Snapshot-Based Pagination chapter);
OBS.: It's possible to retrieve $top records using Server-side pagination using customPageSize=X parameter, however, if the first page is called multiple times without calling the following pages, a security measure will block the user. This is explained in detail in the KBA 2749091;
Keywords
OData, API, query, get, retrieves, returns, retrieving, returning, unexpected, undesired, wrong, incorrect, results, response, records, $top, $skip, top, skip, server, client, side, pagination , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem