Error using POST method to send document to DCTM from SharePoint Online

Hi all,
I am trying to connect DCTM with SharePoint online and send single document using SPO flow. I am using REST API for it.

URI: dctm_path/rest/repositories/repository_name/folders/folder_id/documents
Followings are the parameters I am passing:
object: {"properties":{"r_object_type":"custon_object_type","object_name":"Test10","title":"Test10"}}
binary: test
content-type: application/vnd.emc.documentum+json;charset=UTF-8

While running the flow, I am getting following error:

{
"status": 400,
"code": "E_INPUT_MESSAGE_NOT_READABLE",
"message": "The input message is not readable.\r\nclientRequestId: 2fe2b792-56f0-4355-95a2-1787318768f4",
"details": "Required request body is missing: public com.emc.documentum.rest.model.DocumentObject com.emc.documentum.rest.controller.FolderChildDocumentsController.createChildDocument(java.lang.String,com.emc.documentum.rest.model.DocumentObject,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,com.emc.documentum.rest.http.UriInfo) throws com.documentum.fc.common.DfException,org.springframework.web.bind.MissingServletRequestParameterException",
"id": "2a47e10b-bd8e-4fce-a873-fd64a42b2503"
}

It seems that I am missing some parameter here. What can be the solution for it?

Comments

  • edited 9:58AM

    hi,
    enclosed POJO which depends on rest-assured java library(https://mvnrepository.com/artifact/io.rest-assured/rest-assured/4.0.0) to trigger POST call to upload document into Documentum Server using dctm-rest API

    import io.restassured.response.Response;

    import java.io.File;
    import java.io.IOException;

    import static io.restassured.RestAssured.given;

    public class DocumentImport {
    private static String absoluteURL = "http://localhost:8181/dctm-rest/repositories/myRepo/folders/folder_r_object_id/documents";
    private static Response response = null;
    private static String userName = "c";
    private static String userPassword = "c";
    private static String fileName = "c:/temp/Sreecharan_Shroff.pdf";
    private static String objectName = "{\"properties\":{\"object_name\":\"Sreecharan_Shroff.pdf\"}}";

    public static void main(String[] args) {
        try {
            documentImport();
            System.out.println(response.asString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    public static void documentImport() throws IOException {
        response = given().multiPart("object", objectName)
                .multiPart("content", new File(fileName)).auth()
                .basic(userName, userPassword).when().post(absoluteURL);
    }
    

    }

Sign In or Register to comment.