Symptom
When creating an attachment via Postman, below error that attachment file is not supported is returned as a response.
Sample Request Payload
{
"__metadata": {
"uri": "Attachment"
},
"userId": "cgrant",
"fileName": "f1.docx",
"description": "des1",
"fileContent": "ZHV6aWVsZQ==",
"viewable": true,
"deletable": false,
"moduleCategory": "PERFORMANCE_ASSESSMENTS",
"module": "PERFORMANCE_MANAGER"
}
Sample Response Body
<?xml version="1.0" encoding="utf-8"?>
<error xmlns=" http://schemas.microsoft.com/ado/2007/08/dataservices/metadata "> <code>COE_GENERAL_SERVER_FAILURE</code>
<message lang="en-US">[COE0019]The file type of testJC1.docx is not supported for attachments</message></error>
Environment
SAP SuccessFactors Recruiting Management
Reproducing the Issue
- Perform Odata API Upsert/Insert Operation using SFOdata.Attachment entity
- See error when upserting/insert xx.docx, xx.doc file or fileContent string.
Cause
When a non MS Word document type was in fact not converted to base64 string.
If the fileName is xxx.doc or xxx.docx, but the file content is not a MS Word document, the Insert/Upsert/Update operation of API will not succeed.
Examples of occurence: a string or text file was instead converted to base64; an RTF file was renamed as .doc/.docx extension, etc.
Resolution
Ensure that the data in 'fileContent' field of the request payload is a valid base64 encoded string of a xx.doc or xx.docx file. (You may use the instructions in resolution of KBA 2940547 to check that)
See Also
SAP SuccessFactors HCM Suite OData API: Reference Guide
2940547 - How to decode file content extension name in Postman - Recruiting Management
Keywords
SFOdata.Attachment, xxx.do, xxx.docx, MS Word Odata Attachment, fileContent, base64, [COE0019]The file type of **.docx is not supported for attachments , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , Problem