Expand my Community achievements bar.

SOLVED

Can you use AEM Query Builder to pull Metadata values as JSON?

Avatar

Level 2

We are wanting to create a string of metadata values that will return only those wanted values as JSON. Can AEM Query builder be used to build this query or test it? If so, are there are documents around what metadata values are available?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Let's assume I am targeting list of properties like dc:format , dam:size, dc:modified of each asset under specific DAM path /content/dam/we-retail/en/people/mens

So here is my query -

 

type=dam:Asset
path=/content/dam/we-retail/en/people/mens
p.hits=selective
p.properties=jcr:content/metadata/dc:format jcr:content/metadata/dam:size jcr:content/metadata/dc:modified

 

using p.properties , I have specified the properties I want to get in as shown below -

DEBAL_DAS_0-1648877023744.png

Now if I copy and JSON QueryBuilder link as shown below -

 

DEBAL_DAS_1-1648877128035.png

http://localhost:7070/bin/querybuilder.json?p.hits=selective&p.properties=jcr%3acontent%2fmetadata%2...

 

Then I am getting  below JSON response -

DEBAL_DAS_2-1648877252903.png

 

Are you expecting this? Please correct me.

 

Please refer this: https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...

 

DEBAL_DAS_3-1648877352316.png

 

 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Let's assume I am targeting list of properties like dc:format , dam:size, dc:modified of each asset under specific DAM path /content/dam/we-retail/en/people/mens

So here is my query -

 

type=dam:Asset
path=/content/dam/we-retail/en/people/mens
p.hits=selective
p.properties=jcr:content/metadata/dc:format jcr:content/metadata/dam:size jcr:content/metadata/dc:modified

 

using p.properties , I have specified the properties I want to get in as shown below -

DEBAL_DAS_0-1648877023744.png

Now if I copy and JSON QueryBuilder link as shown below -

 

DEBAL_DAS_1-1648877128035.png

http://localhost:7070/bin/querybuilder.json?p.hits=selective&p.properties=jcr%3acontent%2fmetadata%2...

 

Then I am getting  below JSON response -

DEBAL_DAS_2-1648877252903.png

 

Are you expecting this? Please correct me.

 

Please refer this: https://experienceleague.adobe.com/docs/experience-manager-65/developing/platform/query-builder/quer...

 

DEBAL_DAS_3-1648877352316.png

 

 

 

Avatar

Level 2

@jwendling 
AEM Query builder can be used to query the repository and get a list of nodes (javax.jcr.node) or hits (com.day.cq.search.result.Hit)

To get specific properties or metadata from each node, we will have to have custom implementations, via a sling model/OSGi servlet/OSGi service.
Hope this helps.