Hi Team, I have a requirement how to query assets using a particular tag in AEM using GraphQL. I have even tried with chat GPT and Copilot but not getting required output some errors are coming. Below are the errors I am getting
kindly help on this
Views
Replies
Total Likes
To query content fragments based on tag
Use the GraphQl query in the below manner
query {
cityList(
includeVariations: true,
filter: {_tags: {_expressions: [{value: "tourism:city-break", _operator: CONTAINS}]}}
){
items {
name,
_tags
}
}
}
Views
Replies
Total Likes
I want to query the assets like images present inside content/dam not the content fragment
Views
Replies
Total Likes
To query images present in DAM, you will have to prefer using Query builder API or JCR SQL2 query instead of GraphQl
Views
Replies
Total Likes
But we are using graphql to send json response to UI team...so we have this requirement to fetch the list of images having a particular tag using graphql and send the response to UI.By any chance can we achieve this?
Views
Replies
Total Likes
There is no OOTB way of doing it
You will have to write custom implementation to convert response from query builder to graphql format
Hi @VedhaSri ,
currently GraphQL is used for content fragment only, we use querybuilder.json to get the asset with a given tag like below
However if /bin/querybuilder.json is blocked from end user for security concern we can write same query in servlet
Thanks
Views
Replies
Total Likes
Views
Likes
Replies