cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS service example to create a document

everbehere
Champ in-the-making
Champ in-the-making
I am very new to Alfresco and as part of our project requirement we need CMIS service for creating a document in JSON and not in atompub. I have an example for CMIS service for creating a document in atompub. Here is the link for the example.
http://blog.mwrobel.eu/uploading-big-file-alfresco-web-services/

If someone can help me having the some example of CMIS service for this in JSON format. Also it will be very helpful if its known which is better if we have files of 8MB or more.

Thanks in advance
3 REPLIES 3

kaynezhang
World-Class Innovator
World-Class Innovator
Why not just use open cmis api ? Using open cmis api you don't need to care aboud binding details .

In our Project there is a requirement that instead of making a call to JAVA APIs they want to make a call to RESTful APIs. That is the reason I am looking for something for an example for CMIS service for creating a document in JSON

kaynezhang
World-Class Innovator
World-Class Innovator
CMIS  Browser binding is used by  a browser client to interact with cmis repository using html form to perform operations.
So all you have to do is create send a html multipart form-data request to browser binding url.

For example if you want to create a document with content.

<form
  // action link depends on which operation wish to perform
  action="http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser/folder1/object"
  method="POST"
  enctype="multipart/form-data">
<input name="cmisaction" type="hidden" value="createDocument" />
  // for each cmis object type property, create 2 corresponding input texts field mapped to that properties value
<input name="propertyId[0]" type="hidden" value="cmis:name" />
<input name="propertyValue[0]" type="text" value="my document" />
<input name="propertyId[1]" type="hidden" value="cmis:objectTypeId" />
<input name="propertyValue[1]" type="hidden" value="my:firstObjectType" />
<input name="propertyId[2]" type="hidden" value="my:intProperty" />
<input name="propertyValue[2]" type="text" value="42" />

  // for content stream
  <input name="content" type="file" />
</form>