SAP Knowledge Base Article - Public

2317289 - How to query the SF Odata Photo entity and retrieve the image

Symptom

This document explains - 

  1. How to perform a query operation using the Odata API entity?
  2. What is the API response in this case?
  3. How to retrieve the photo from the API response?

Environment

Successfactors

Resolution

 1. Odata API request to fetch the user's photo.

/odata/v2/Photo?$filter=userId%20eq%20%27admin%27&$select=photo

Understanding the Query url:

Entity used - Photo (Odata)

Filter - User id is filtered (where user id = admin) 

Select - Photo.

 2. Odata API response for the above call.

Please refer to the attachment API response.txt

The binary data for the photo is extracted and attached in the attachments section.

 3. How to retrieve the photo back to jpg?

You would require another tool to decode binary data to another format like jpg. 

In this document, we have used a third party online tool to perform the decode.

binary to jpg.jpg

   You could use any relevant application/tool to generate the image.

See Also

The system stores several images for a single user's profile picture in different sizes to be used in different applications.

For example, thumbnail size images are used in the org chart, quick card and faces page, while larger size images are used in the employee profile.

The different photo types are categorized by the photoType field. You can query for a specified photoType. All photos with the identified photoType for all active users are returned.
To retrieve photos for a given userId but different photoType, you need to specify the userId in the query.

To retrieve a single photo for a given userId and photoType, you need to put both of them into query criteria.

Keywords

  • Photo entity
  • How to get photo using API
, KBA , LOD-SF-INT , SF Integrations - EC Payroll, Boomi/ HCI, API , LOD-SF-INT-API , SF API & Adhoc API Framework , How To

Product

SAP SuccessFactors HCM Core 1602 ; SAP SuccessFactors HCM Suite all versions

Attachments

API response.txt