The example body below shows how to define a simple CMIS query to find all files with a name starting with test:
{
"query": {
"query": "select * from cmis:document WHERE cmis:name LIKE 'test%'",
"language": "cmis"
}
}
Here is how the call looks like, assuming that we have stored the query JSON data in a file called cmis-query.json (it does not work to write the query with the -d curl parameter on the command line):
$ curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' --header 'Authorization: Basic VElDS0VUXzIxYzAzOWMxNjFjYzljMDNmNmNlMzAwYzAyMDY5YTQ2OTQwZmYzZmM=' --data-binary '@cmis-query.json' 'http://localhost:8080/alfresco/api/-default-/public/search/versions/1/search' | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1329 0 1212 100 117 15150 1462 --:--:-- --:--:-- --:--:-- 16822
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"isFile": true,
"createdByUser": {
"id": "admin",
"displayName": "Administrator"
},
"modifiedAt": "2019-10-03T08:37:17.832+0000",
"nodeType": "cm:content",
"content": {
"mimeType": "application/x-javascript",
"mimeTypeName": "JavaScript",
"sizeInBytes": 118,
"encoding": "UTF-8"
},
"parentId": "fa62d870-061c-400f-a3c5-12a37fe0738e",
"createdAt": "2019-10-03T08:37:17.832+0000",
"isFolder": false,
"search": {
"score": 1
},
"modifiedByUser": {
"id": "admin",
"displayName": "Administrator"
},
"name": "test return value.js.sample",
"location": "nodes",
"id": "6b0b7a4c-1630-47ec-9c2f-7620c1cefeed"
}
},
{
"entry": {
"isFile": true,
"createdByUser": {
"id": "admin",
"displayName": "Administrator"
},
"modifiedAt": "2019-11-07T10:43:43.279+0000",
"nodeType": "cm:content",
"content": {
"mimeType": "text/plain",
"mimeTypeName": "Plain Text",
"sizeInBytes": 9,
"encoding": "UTF-8"
},
"parentId": "6b661ba4-830b-457d-af04-46f174351536",
"createdAt": "2019-11-07T10:43:43.279+0000",
"isFolder": false,
"search": {
"score": 1
},
"modifiedByUser": {
"id": "admin",
"displayName": "Administrator"
},
"name": "test-file.txt",
"location": "nodes",
"id": "9613e418-b1c1-4889-8866-4dccda66a258"
}
}
]
}
}