Files CMIS API extensions: Browser binding extensions Added by IBM on January 6, 2011 | Version 1
|
The Files CMIS API provides the following extensions for use in CMIS clients to simplify interaction from a browser client that needs to use an HTML form to perform binary transfer operations.
|
The Files CMIS API provides the following extensions for use in CMIS clients to simplify interaction from a browser client that needs to use an HTML form to perform binary transfer operations.
These extensions allow clients to perform the following CMIS operations using an HTML form endpoint:
- createDocument
- createFolder
- updateProperties
To invoke these operations, the RESTful Atompub Binding has been extended with two new link relations.
Document Entry, Folder Entry, Policy Entry, Relationship EntryLink relations:
- http://www.ibm.com/xmlns/prod/sn/cmis/multipart-form/object
- PUT (mediatype="multipart/form-data"), response=text/html
Folder EntryLink relations:
- http://www.ibm.com/xmlns/prod/sn/cmis/multipart-form/folderChildrenCollection
- POST (mediatype="multipart/form-data"), response=text/html
- createDocument
- createFolder
To make a multipart form-data request, the following conversion is used to translate a CMIS Object domain model representation into a HTML multipart form-data request:
- For each property defined on the CMIS object, a corresponding part is produced in the HTML form, where the part is identified by the CMIS object property id.
- To transfer a binary resource, a file part is needed in the HTML form with an identifier of cmis:contentStream. If a file part is included, it is used to set the associated file contents for the resource in the CMIS server.
- To apply tags on a resource, a form part with the name snx:tags should be supplied. The form value should be a space delimited set of tags to apply to the resource.
Sample request form:
<form
// action link depends on which operation wish to perform
action="{insert link from rel="http://www.ibm.com/xmlns/prod/sn/cmis/multipart-form/folderChildrenCollection"}"
action="{insert link from rel="http://www.ibm.com/xmlns/prod/sn/cmis/multipart-form/object"}"
method="POST"
enctype="multipart/form-data">
// for each cmis object type property, create a corresponding input text field mapped to that properties value
<input type="text" name="cmis:name" value="{value of cmis:name}"/>
<input type="text" name="cmis:objectTypeId" value="{value of cmis:objectTypeId (i.e. snx:file, snx:collection, etc.) }"/>
...
// for an object type that has a content stream (i.e. cmis:document, snx:file, etc.)
<input type="file" name="cmis:contentStream"/>
</form>
Sample response form, Media Type: text/html:
<html>
<head>
<meta name="status" content="{HTTP-STATUS-CODE-FOR-OPERATION-SUCCESS}"/>
</head>
<body>
// cmis object in JSON syntax, where each property id on object is a key in the json object
{
"properties": [
// for each property on type
{ "displayName":"Id",
"value": [{"value":"snx:file!1234"}],
"propertyDefinitionId":"cmis:objectId",
"queryName":"cmis:name",
"propertyType":"string"
}
],
"links": [
// for each link relation per Restful Atompub Binding declared on resource
{ "href":"link-to-resource",
"type":"media-type-of-linked-resource",
"rel":"rel-name (i.e. edit, self, alternate, etc.)"
]
}
</body>
</html>
Parent topic: Files CMIS API extensions
|