Symptom
You perform an API call like the one below:
https://<api_endpoint>/odata/v2/Photo?$top=100&$format=json
And instead of returning all 100 records, it returns just a few of them, like only 80 for example (20 records missing).
Now you perform this other query below:
https://<api_endpoint>/odata/v2/Photo?$top=200&$format=json
And it returns 180 records. It is missing 20 records again!
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
- SAP SuccessFactors HXM Suite
- OData API
Resolution
In Photo API, the $top parameter works differently.
Photo API uses photoId to do pagination, but using photoType and userId as key properties. The expected logic considered by the API is that there should be only one Photo record for each photoType and userId. So in the page, if there are multiple records (different photoId) with same photoType and userId, then only one record of them will be returned due to that logic.
The issue is occurring because there are multiple photoId with the same photoType and userId values. When the results are calculated in the API call, only one of these multiple records are returned, the rest of them get hidden in the results.
The solution for this could be identifying which userId has several Photos with the same photoType and exclude it from the API query, like below:
https://<api_endpoint>/odata/v2/Photo?$top=100&$format=json&$filter=userId ne 'sampleUser'
In this case, sampleUser is the userId with several Photos with the same photoType.
See Also
Keywords
top, query, found, extract, result, payload, response, photoType, userId, photoId, entity , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem