Itamar Ribeiro
Itamar Ribeiro

Reputation: 37

Alfresco 5.2 REST API CMIS Query

Until version 201609, we used the following url to get the nodeRef from the Sites folder and from a Script inside the Data Dictionary. We used this information for automatic rule creation via javascript.

/alfresco/api/-default-/public/cmis/versions/1.1/browser?cmisaction=query&statement=select alfcmis:nodeRef from cmis:folder where cmis:name='Sites' and CONTAINS('PATH:"//app:company_home/*"')

The result was:

{
"results": [
{
"properties": {
"alfcmis:nodeRef": {
"id": "alfcmis:nodeRef",
"localName": "nodeRef",
"queryName": "alfcmis:nodeRef",
"type": "id",
"value": [
"workspace://SpacesStore/c08c5d35-f0a3-4330-b783-05c7d773d2d0"
]
}
}
}
],
"hasMoreItems": false,
"numItems": 1
}

In the 201612 and 201702 days, when trying to execute the query (by POST), we received the error:

{
"exception": "invalidArgument",
"message": "Invalid form encoding!"
}

The question would be: Using REST API how to get(by POST) the same result in the 201612 and later versions?

Upvotes: 0

Views: 1541

Answers (1)

Florian Müller
Florian Müller

Reputation: 3235

If you do a POST, you have to put the query in the body, not in the URL. (See https://docs.oasis-open.org/cmis/CMIS/v1.1/os/examples/browser/doQuery-request.log .)

If you do a GET, replace cmisaction with cmisselector.

POST and GET should return the same result.

Upvotes: 3

Related Questions