GET/POST
http://yourserver.com/services/browse ?path=<assetPath> &fromRoot=<folderPath> &includeFolders=<true|false> &includeAssets=<true|false> &includeExtensions=<comma-delimited extensions> |
What does it do?
Browse folders.
This call is designed to make it possible to browse folders and show their subfolders and collections, similar to how folder browsing works in Assets.
Note: Even though it is possible to return the assets in folders, doing so is not advised. The browse call does not limit the number of results, so if there are 10000 assets in a folder it will return all of them. It is better to use a search to find the assets in a folder and fetch them in pages.
Log in requirement
Before being able to request information from Assets Server by using a GET request or make changes to the system through a POST request, a log in to Assets Server is required. For information about the available APIs for logging in, see Assets Server REST API - introduction.
Parameters
path |
The path to the folder in Assets Server you want to list. Make sure the URL is properly URL-encoded, for example: spaces should often be represented as %20. Required. |
fromRoot |
For returning multiple levels of folders with their children. When specified, this path is listed, and all folders below it up to the 'path' will have their children returned as well. This ability can be used to initialize an initial path in a column tree folder browser with one server call. Optional. When not specified, only the children of the specified 'path' will be returned. |
includeFolders |
Indicates if folders should be returned. Optional. Default is true. |
includeAsset |
Indicates if files should be returned. Optional. Default is true, but filtered to only include 'container' assets. |
includeExtensions |
A comma separated list of file extensions to be returned. Specify 'all' to return all file types. Optional. Default includes all 'container' assets: .collection, .dossier, .task |
Return value
An array of folders and assets in JSON format. Each item in the array has the following properties:
name | The name of the asset or folder. |
assetPath |
The full path of the asset or folder in Assets Server. |
directory |
true or false. Indicates that this is a directory. If so, you can perform another browse call with the assetPath of this folder. |
containerId |
Only available for container assets, for example a collection. If available, you can perform a search for items related to the specified collection id. |
Examples
browse http://demo.assets-server.com/services/browse ?path=/Demo Zone |
Returns the subfolders of the Demo Zone:
[
{
"name" : "Archive",
"directory" : true,
"assetPath" : "/Demo Zone/Archive"
}, {
"name" : "Collections",
"directory" : true,
"assetPath" : "/Demo Zone/Collections"
}, {
"name" : "Images",
"directory" : true,
"assetPath" : "/Demo Zone/Images"
}, {
"name" : "Office",
"directory" : true,
"assetPath" : "/Demo Zone/Office"
}, {
"name" : "Video",
"directory" : true,
"assetPath" : "/Demo Zone/Video"
}
]
browse http://demo.assets-server.com/services/browse ?fromRoot=/ &path=/Demo Zone/Images |
Lists all folders from the root up to and including 'Demo Zone/Images':
[
{
"name" : "DAMTube",
"directory" : true,
"assetPath" : "/DAMTube"
}, {
"name" : "Demo Zone",
"directory" : true,
"assetPath" : "/Demo Zone",
"children" : [ {
"name" : "Archive",
"directory" : true,
"assetPath" : "/Demo Zone/Archive"
}, {
"name" : "Collections",
"directory" : true,
"assetPath" : "/Demo Zone/Collections"
}, {
"name" : "Images",
"directory" : true,
"assetPath" : "/Demo Zone/Images",
"children" : [ {
"name" : "Events",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Events"
}, {
"name" : "Food",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Food"
}, {
"name" : "Nature",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Nature"
}, {
"name" : "People",
"directory" : true,
"assetPath" : "/Demo Zone/Images/People"
}, {
"name" : "Travel",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Travel"
}
]
}, {
"name" : "Office",
"directory" : true,
"assetPath" : "/Demo Zone/Office"
}, {
"name" : "Video",
"directory" : true,
"assetPath" : "/Demo Zone/Video"
} ]
}
]
browse http://demo.assets-server.com/services/browse ?path=/Demo Zone/Images/Travel |
Returns the sub items of the 'Demo Zone/Images/Travel' folder. In this case, the folder contains two collections:
[
{
"name" : "Architecture",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Travel/Architecture"
}, {
"name" : "Cities",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Travel/Cities"
}, {
"name" : "Landmarks",
"directory" : true,
"assetPath" : "/Demo Zone/Images/Travel/Landmarks"
}
]
Search content of folders and collections
Browse calls are only meant to be used for browsing folder structures. To display the actual assets residing in those folders and collections you need to use a search call.
To search for all assets in the Demo Zone and all its subfolders:
search http://demo.assets-server.com/services/search ?q=ancestorPaths:"/Demo Zone" |
To search for the assets located in /Demo Zone/Images. Assets in subfolders will not be returned:
search http://demo.assets-server.com/services/search ?q=folderPath:"/Demo Zone/Images" |
To search for the contents of a collection using a relation search:
search http://demo.assets-server.com/services/search ?q=relatedTo:5LMAQTW9qfhANn7f6JJVpl relationTarget:child relationType:contains |
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.