When using the Alfresco REST API, searching documents contained in a folder or in a folder hierarchy can be achived by some different ways.
You can examine these options in Structure, tags, categories and query documentation page.
If you are aware of the whole path for a parent folder, then you can use something similar to the following query to find every folder or document contained directly in this parent folder.
curl --location --request POST 'http://127.0.0.1:8080/alfresco/api/-default-/public/search/versions/1/search' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
"query":{
"query":"PATH:\"app:company_home/st:sites/cm:swsdp/cm:documentLibrary/*\" AND cm:name:\"Meet*\""
}
}
'
If you want to perform the same search in all the folder hierarchy below the parent folder, you can use this one.
curl --location --request POST 'http://127.0.0.1:8080/alfresco/api/-default-/public/search/versions/1/search' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
"query":{
"query":"PATH:\"app:company_home/st:sites/cm:swsdp/cm:documentLibrary//*\" AND cm:name:\"Meet*\""
}
}
'
Finally, if you code an application that is not aware of the path but only of the Node Id of the parent folder, you can try something like the following one.
curl --location --request POST 'http://127.0.0.1:8080/alfresco/api/-default-/public/search/versions/1/search' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
"query":{
"query":"ANCESTOR:\"workspace://SpacesStore/a211774d-ba6d-4a35-b97f-dacfaac7bde3\" AND cm:name:\"Meet*\""
}
}'
>> There are many other ways to get nodes in a folder with the REST API. Have you any other to contribute?