Expand my Community achievements bar.

SOLVED

Fetch DAM Assets grouped by Folder Structure

Avatar

Level 2

Hi All,

I want to check and see if there is a way within either the Query Builder or any of the API's where we can get all the assets under a given path grouped by folder structure

Here is a sample query that just gets the assets based on type

http://localhost:6602/bin/querybuilder.json?p.guesstotal=true&p.hits=full&p.limit=-1&p.nodedepth=2&p...

I want to see if we can get the JSON including the folder name and all the assets under the folder name grouped via folders.

I can use the Query Builder API  to get the folders alone and then construct a custom JSON to get all child nodes under each folder of the Type Assets and their metadata but want to check and see if there is a better way to do this.

Any suggestions are helpful

Thanks,

Ravi

1 Accepted Solution

Avatar

Correct answer by
Level 10

You could use any type of query in source code - QB, SQL2, xpath. Make sure to make it more specific and fetch relevant data to optimize it.

sample SQL2 query to just fetch asset/folder names with url1. Based on your requirements, you could add metadata or other nodes..

SELECT * FROM [dam:Asset] as s WHERE (NAME() LIKE '%.jp%' or NAME() LIKE '%.png') and ISDESCENDANTNODE(s,'/content/dam/we-retail')

View solution in original post

2 Replies

Avatar

Level 10

Looks like your way of using QB API and then constructing JSON is the solution here.

Avatar

Correct answer by
Level 10

You could use any type of query in source code - QB, SQL2, xpath. Make sure to make it more specific and fetch relevant data to optimize it.

sample SQL2 query to just fetch asset/folder names with url1. Based on your requirements, you could add metadata or other nodes..

SELECT * FROM [dam:Asset] as s WHERE (NAME() LIKE '%.jp%' or NAME() LIKE '%.png') and ISDESCENDANTNODE(s,'/content/dam/we-retail')