Alfresco API to list All Files (in a Site/Node/Folder etc)

cancel
Showing results for 
Search instead for 
Did you mean: 
fawadali123
Active Member

Alfresco API to list All Files (in a Site/Node/Folder etc)

Jump to solution

I am Alfresco Community Edition user. Exploring REST API but i cannot find APIs to list all files ,List Files in a Site, List All Files in a NODE, List All files for a specific Users etc. Someone answered on stackoverflow that its not not available out of the box.

http://localhost:8080/api-explorer/#!/sites/getSiteContainer

Can anyone help or provide some links for Alfresco REST API with comprehensive details/examples?

1 Solution

Accepted Solutions
fawadali123
Active Member

Re: Alfresco API to list All Files (in a Site/Node/Folder etc)

Jump to solution

I can get list of all files as below;

http://localhost:8080/alfresco/service/slingshot/doclib/doclist/node/site/{siteId}/documentlibrary/ 

May not be the best approach but looks like a work around for me at the moment. 

View solution in original post

4 Replies
afaust
Master

Re: Alfresco API to list All Files (in a Site/Node/Folder etc)

Jump to solution

The children operation on nodes should be ideal to get all files under a specific node. For sites there is no such operation to get all files in one go, except by going through queries. This is due to the fact that there can be any number of hierarchies that cannot be covered by a single navigation operation. The same goes for all files of a user, using either the cm:creator or cmSmiley Surprisedwner properties to determine "belonging to user" (cmSmiley Surprisedwner takes preference, i.e. if cmSmiley Surprisedwner is set, cm:creator is to be ignored).

fawadali123
Active Member

Re: Alfresco API to list All Files (in a Site/Node/Folder etc)

Jump to solution

Thank for a quick reply.  I will go through it. 

fawadali123
Active Member

Re: Alfresco API to list All Files (in a Site/Node/Folder etc)

Jump to solution

I can get list of all files as below;

http://localhost:8080/alfresco/service/slingshot/doclib/doclist/node/site/{siteId}/documentlibrary/ 

May not be the best approach but looks like a work around for me at the moment. 

gtarafder
Active Member

Re: Alfresco API to list All Files (in a Site/Node/Folder etc)

Jump to solution

I have achieved this using search API and PrefixPath.

Can be helpful for someone else

{
"query": {
"query": "PATH:\"/app:company_home/st:sites/cm:product-information/cm:documentLibrary//*\" AND (TYPE:\"cm:content\" OR TYPE:\"cm:folder\")",
"language": "lucene"
},
"include": ["properties"]
}