SAP Knowledge Base Article - Public

2910535 - How to upload attachment to EC Portlet National ID via API?

Symptom

How to upload attachment to EC Portlet National ID via API?

Environment

SuccessFactors HXM Suite

Resolution

This can be done in 2 steps:

Step 1: Create attachment in the system using OData Upsert for Attachment API entity.

OData Upsert Request for Attachment API:

[{"__metadata":{"uri":"Attachment"},"documentCategory":"NATIONAL_ID","documentEntityId":"111","documentEntityType":"PERSON","fileContent":"XXXX","fileName":"sfadminNI.docx","module":"HRIS","moduleCategory":"HRIS_ATTACHMENT","userId":"sfadmin"}]

OData Upsert Response for Attachment API:

{ "d" : [ { "key" : "Attachment/attachmentId=8230", "status" : "OK", "editStatus" : "UPSERTED", "message" : "Upserted successfully", "index" : 0, "httpCode" : 200, "inlineResults" : null } ] }

Step 2: Use the attachment ID generated to upload document in National ID portlet using perNationalID API entity.

OData Upsert Request for perNationalID API:

[{"__metadata":{"uri":"PerNationalId(cardType='ssn', country='USA', personIdExternal='sfadmin')"},"cardType":"ssn","country":"USA","personIdExternal":"sfadmin","attachmentId":"8230","isPrimary":true,"nationalId":"XXX-XX-XXXX"}]

OData Upsert Response for perNationalID API:

{ "d" : [ { "key" : "PerNationalId/cardType=ssn,PerNationalId/country=USA,PerNationalId/personIdExternal=sfadmin", "status" : "OK", "editStatus" : "UPSERTED", "message" : null, "index" : 0, "httpCode" : 200, "inlineResults" : null } ] }

Keywords

 perNationalId, AttachmentId , KBA , LOD-SF-INT-ODATA , OData API Framework , How To

Product

SAP SuccessFactors HXM Suite all versions