CMIS search problem in public REST API

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
djole87
Member II

CMIS search problem in public REST API

Hi everyone,

I'm am trying to integrate with Alfresco using it's public REST API and I found some limitations there so far.
Currently I'm using Alfresco 5.2 Community edition.

First I was not able to get list of all available fields on a node, as it is not possible to get dictionary info using Alfresco's public REST API. With above mentioned, I assume I cannot also get list of all available permissions that one can set on a node, please correct if I'm wrong?

Now if I'm using search API, and cmis QL, I'm not able to get just specific properties from the cmis:document. If I use following POST call:
http://localhostSmiley Tongueort/alfresco/api/-default-/public/search/versions/1/search
with following body parameter:
{
   "query": {
      "language": "cmis",
      "query": "select * from cmis:document where cmis:name like 'tes%'",
   }

}
result I've got is as expected.

But if I use query to select specific cmis properties e.g. 
"query": "select cmisSmiley SurprisedbjectId from cmis:document where cmis:name like 'djur%'",
it returns me exactly the same subset of data as I'm using '*'.

Is this a bug in Alfresco public REST API, or is there another way to achieve what I described above?

Thanks in advance,
Djordje 

5 Replies
prachi_shah_c2
Active Member II

Re: CMIS search problem in public REST API

Hi,

You can use the fields JSON body parameter to restrict the fields returned within a response Like:

{
"query": {
"language": "cmis",
"query": "select * from cmis:document where cmis:name like 'tes%'"
},
"fields": ["id"]
}

Please refer this Alfresco Content Services REST API Explorer 

Thanks,

Prachi

djole87
Member II

Re: CMIS search problem in public REST API

Hi Prachi,

Thanks for your response. Yeah I know that I can use fields property to filter fields I would like to see in the response.

In my use case users are writing these queries and sending it to the service I provide. And to use fields property you've mentioned, I would need to know exact mapping between all cmis available properties and alfresco fields (objectId->id, name->name... ) and I'm not sure how to know these mappings.

Best Regards,
Đorđe

afaust
Master

Re: CMIS search problem in public REST API

There really are not that many CMIS properties to map.

  • cmisSmiley SurprisedbjectId => id
  • cmisSmiley SurprisedbjectTypeId => nodeType
  • cmis:secondaryObjectTypeId => aspectNames
  • cmis:name => name
  • ...

Most/all of those should be quite easy to figure out by looking at the documentation of the response schema for the search operation, e.g. that cmis:createdBy maps to createdByUser etc.

djole87
Member II

Re: CMIS search problem in public REST API

Hi Axel,

Thanks for your response.

Do you maybe know to which Alfresco fields the following cmis props are mapped?

  • cmis:isImmutable
  • cmis:isLatestVersion
  • cmis:isMajorVersion
  • cmis:isLatestMajorVersion
  • cmis:versionLabel
  • cmis:versionSeriesId
  • cmis:isVersionSeriesCheckedOut
  • cmis:versionSeriesCheckedOutBy
  • cmis:versionSeriesCheckedOutId
  • cmis:checkinComment
  • cmis:contentStreamFileName
  • cmis:contentStreamId

Best Regards,
Đorđe

afaust
Master

Re: CMIS search problem in public REST API

  • cmis:versionLabel => properties.cm:versionLabel

The other properties all have no directly corresponding Alfresco properties / fields.