AnsweredAssumed Answered

Searching for a document in a folder via REST API

Question asked by edcearl on Mar 8, 2017

Using the POST /alfresco/api/-default-/public/search/versions/1/search (REST API):

 

If you need to search for a file in a specific folder, the following query worked for me:

{
"query": {
"language": "afts",
"query": "=PARENT:80c4e9ad-0a8e-4e25-a121-792b140a860a AND =name:'filenamehere.txt'"
}
}

 

The trick was to use '=' signs at the beginning of the query conditions. Without that it would not properly evaluate the query (returned nothing when both conditions were present). 

 

Searching for a specific folder in a folder:

{
"query":{
"query": "SELECT cmis:objectId FROM cmis:folder WHERE cmis:name = 'foldernamehere' and cmis:parentId = '308c9353-2de8-429a-8f1a-82ab250b5f12'",
"language": "cmis"
}
}

Outcomes