Hi all,
I'm uploading a new version of a node using CMIS, by following this instructions. I'm using Alfresco 6.2 ootb installation with docker.
I'm able to retrieve nodes' content, and to upload a new version, but I wonder if I can provide a version description, as can be done through the Alfresco ReST API and Alfresco Version2Service.
I've tried adding form data to the http call, but I see no results:
// Post new content to Alfresco as a new version using CMIS API HttpPut put = new HttpPut(alfrescoBaseUrl + CMIS_URL + "content?id=" + ocrNodeId); // Create request entity requestEntityBuilder = MultipartEntityBuilder.create(); requestEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); requestEntityBuilder.addBinaryBody("file", inputStream); requestEntityBuilder.addPart("versionComment", new StringBody("new version test", ContentType.MULTIPART_FORM_DATA)); // Tried with description, versionComment, versionDescription requestEntity = requestEntityBuilder.build(); put.setEntity(requestEntity);
It's the first time I'm using CMIS, and I've seen that Alfresco documented in a different way CMIS operations for the new 201911 GA version, so I'd like to know:
I've already looked at the service document as stated here, but I don't get a s***, nor I haven't found any "getting started guide" for OASIS standard but the oasis standard specification, which is too much for me at the moment.
Thanks in advance!
You should be using a CMIS client (like one from Apache Chemistry). It will save you a lot of trouble.
What you are trying to do is set a checkin comment. With something like OpenCMIS, it is as easy as:
ObjectId newVersionId = pwc.checkIn(true, null, null, "new version comment");
You can see additional OpenCMIS sample code here:
https://chemistry.apache.org/docs/cmis-samples/samples/versions/index.html
You might also take a look at the CMIS related examples in my custom content types tutorial, although I do not cover checkout/checkin.
As to whether you should use the REST API or CMIS, it is up to you and how closely each API meets your requirements.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.