You are viewing limited content. For full access, please sign in.

Question

Question

cmis browser binding: create folders and documents

asked on September 24, 2018

Hi,

I am testing creation of objects via the CMIS interface and am repeatedly receiveing a constraint violation error.

The CMIS configuration is set up as follows:

{
  "repositories": [
    {
      "server": "WIN2K12",
      "port": 80,
      "name": "TEST",
      "ssl": false,
      "id": "R0",
      "description": "Repository Description",
      "authentication": [ "basic", "token" ],
      "rootFolderId": 1,
      "thinClientUrl": "http://[WAURL]"
    }
  ]
}

 

I have no problem getting correct properties back from a GET request for documents and folders, but when I use Postman to POST a createFolder action (see screenshot) i get the following json returned:

 

{
    "exception": "nameConstraintViolation",
    "message": "Name '' constraint violation."
}

It looks like the json body is being ignored - am I going about this the wrong way ?

 

thanks,

Ian

 

CMIS_Postman.png
CMIS_Postman.png (72.68 KB)
0 0

Answer

SELECTED ANSWER
replied on September 26, 2018

For getting metadata of an object, you can use a CMIS query. Use the following URL structure in a GET request:

http://yourserver/lfcmis/browser/repositoryID/?q=pasteYourQueryHere&cmisselector=query

Replace the variables yourserver, repositoryID, and pasteYourQueryHere with the values you want. For example, if I want to get metadata for the entry with ID 4, I'd paste the following after "q=":

"SELECT * from cmis:document WHERE cmis:objectId='4'"

You'll have to parse the json response or alter the query to get the field values specifically.

0 0
replied on September 26, 2018

Thank you, that's all really useful.  I look forward to the next release with further code samples.

0 0

Replies

replied on September 26, 2018

We'll have more complete code samples in the next release of the SDK, including sample JavaScript to handle responses from the server. For now, here are a few samples for updating/retrieving metadata.

For updating field values or tag comments, use inputs like the following in a form:

<input name='objectId' id='objectId' required='required' />
<input name="propertyId[0]" id='property' required='required' />
<input name="propertyValue[0]" id='newValue' />

<input name="cmisaction" type="hidden" value="update" />

<input id="updateProp" type="submit" value="Update metadata" />

propertyId[0] should be in the format field:fieldname or tagComment:tagname.

propertyValue[0] is the new value of the field or tag comment.

1 0
replied on September 25, 2018

You're missing the following required inputs:

  • the properties array
  • the folder ID for the folder that will be the parent of the new folder.

 

The input IDs and values should be something like the following:

{
  "propertyId[0]" : "cmis:name"
  "propertyValue[0]" : "New Folder"
  "propertyId[1]" : "cmis:objectTypeId"
  "propertyValue[1]" : "lf:folder"
  "folderId" : "1"
}

 

0 0
replied on July 17, 2019

Hi Leif,

I think there's something wacky with your JSON, I think. I can't get this working myself but I'd expect it to look more like:

{ 
properties:[
  {
    "propertyId" : "cmis:name",
    "propertyValue" : "New Folder"
  },
  {
    "propertyId" : "cmis:objectTypeId",
    "propertyValue" : "lf:folder"
  }
  ],
  "folderId" : "1"
}

 

0 0
replied on September 25, 2018

Thank you for that  - I have switched to using form fields rather than json in the request based on that advice and can now create folders.

 

Are there any samples, SDK or otherwise, that would guide me towards updating fields, adding templates and getting a list of field values on a document or folder through CMIS ?  

0 0
replied on September 26, 2018

For assigning templates and tags:

<input class="form-control" name='objectId' id='objectId' required='required' />

<input class="form-control" name="propertyValue[0][0]" id='property' />

<input name="cmisaction" type="hidden" value="update" />

<input name="propertyId[0]" id='cmisType' value='cmis:secondaryObjectTypeIds' type="hidden" />

<input id="updateProp" type="submit" value="Update metadata" />

propertyValue[0][0] would be the tag or template you want to assign to the entry. The format would be tag:tagname or template:templatename.

0 0
replied on July 31, 2019

hi all, 

there is a way to configure two repositories inside the CMIS configuration file (config.json)

This is correct?

thanks!!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.