SAP Knowledge Base Article - Public

2755101 - How to upsert or insert profile photo - SuccessFactors OData API

Symptom

How to create an OData API call to upsert profile photo.

Environment

SuccessFactors BizX - all versions.

Resolution

1. First, it is necessary to check the authorizations for the API user. In order to upsert the profile photo it is required to have the following:

    • Permissions: There is no permission check for query operation. You need to set the following permissions to enable edit operations like Import,Merge,Replace,Upsert and Delete:
    • Role-based: Go to Admin Tools > Manage Permission Roles > Permission Settings > Employee Data > Enable Edit Permission for Photo field and click Done.
    • User-based: Go to Succession Management > Import/Export Data Model . Export the file and edit it to grant write permission on "Photo" element to the correct roles. Import the revised xml file.

2. Then, determine the appropriate OData endpoint as per KBA 2215682 and add the following suffix:

Example: http://<hostname>/odata/v2/upsert?$format=json

3. Encode photo into a base64-string.

4. Send a POST HTTP method and the HTTP header with the authorization and preferred authentication type.

HTTP Header: Accept: application/json
HTTP Header: Content-Type: application/jsonHTTP Body:

[
{ 
 "__metadata": {
               "uri": "Photo(photoType=1,userId='userID')",
               "type": "SFOData.Photo"
},
               "photoType" : 1,
               "userId": "userID",
               "photoName" : null,
               "photo": "BASE64_ENCODED_STRING" 
},
{ 
 "__metadata": {
               "uri": "Photo(photoType=1,userId='userID')",
               "type": "SFOData.Photo"
},
               "photoType" : 1,
               "userId": "userID",
               "photoName" : null,
               "photo": "BASE64_ENCODED_STRING" 
}
]​


Please follow the example formats attached in the "attachment section"

For Insert Scenario --> Insert_photo.zip

For Upsert Scenario --> Upsert_photo.zip

 

Keywords

Upsert photo; OData; URL; , KBA , LOD-SF-INT , SF Integrations - EC Payroll, Boomi/ HCI, API , LOD-SF-INT-ODATA , OData API Framework , How To

Product

SAP SuccessFactors HCM Suite all versions

Attachments

Upsert_photo.zip
Insert_Photo.zip