SAP Knowledge Base Article - Public

3098622 - Photo API entity doesn't return all records in $top API call


You perform an API call like the one below:


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:


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.


  • SAP SuccessFactors HXM Suite
    • OData API


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

Photo API


top, query, found, extract, result, payload, response, photoType, userId, photoId, entity , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem


SAP SuccessFactors HCM all versions