Showing results for 
Search instead for 
Did you mean: 

Issue in creating document using SAP BTP DMS API'S from CAPM nodejs project


Hello All,

We are trying to post a document in BTP DMS using BTP DMS API's from our nodejs CAPM project but unfortunately it creates a document in BTP DMS with corrupted content so unable to read it.Attaching screenshot for reference -

We tried passing the document as bas64string, unitArray, buffer, PDFdoument but nothing works.It creates the document without giving any error but created document is not readable.Below is the nodejs code snippet -

async function _createDocument(sFolderName, folderCreateURL, filedata) {

var formData = new FormData();

// formData.append("objectid", sFolderName);

formData.append("cmisaction", "createDocument");

formData.append("propertyId[0]", "cmis:name");

formData.append("propertyId[1]", "cmis:objectTypeId");

formData.append("propertyValue[1]", "cmis:document");

formData.append("_charset_", "UTF-8");

formData.append("includeAllowableActions", "true");

formData.append("succinct", "true");

formData.append("propertyValue[0]", filedata.fileName);

formData.append("filename", filedata.fileName);

formData.append("media", filedata.fileAsBase64); //passing document as base64 string .Also tried passing it as Buffer, UnitArray and PDFDocument

let headers = formData.getHeaders();

const config = {

headers: headers


var that = this;

const docresponse = await axiosCf({

method: "post",

url: folderCreateURL,

headers: config.headers,

data: formData

}).then(async (result) => {

console.log('Attachment uploaded successfully');

that.docresponse =["cmis:objectId"];

}).catch(error => {

console.log("Attachement upload failed - " + error);

that.docresponse = "";



However, when we test it using postman client which is passing the document as FileObject, it worksPostmanScreenshot -

Does anyone with any idea on how to resolve this issue?

BTP DMS Rest API link used for creating document for reference -

Regards,Jigar Salecha

0 Kudos
@jigar_salecha I am getting similar issue...Did you found any solution for this?
0 Kudos

@jigar_salechaI am getting similar issue...Did you find any solution for this?

View Entire Topic
Product and Topic Expert
Product and Topic Expert
0 Kudos
0 Kudos
This document is related to folder creation, but I want to upload the file to DMS using code where we are facing issues with file format