AEM GraphQL Integration | Community
Skip to main content
Level 3
November 15, 2023
Solved

AEM GraphQL Integration

  • November 15, 2023
  • 1 reply
  • 560 views

An AEM Application is using graphQL and it is returning response as HTTPResponse. Then it is converted into a String. How can we sort the data coming from GraphQL? Can we sort it using the query? Where do we specify the query to get the data in a sorted format?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aanchal-sikka

hello @vineetham123 

 

Adobe has published sample queries on https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-api/sample-queries.html?lang=en#sample-filtering-tag-with-variations. It might be helpful.

 

For sorting look for "sort" keyword in following. Its sorting based on name field

 

{ enginePaginated(after: "SjkKNmVkODFmMGQtNTQyYy00NmQ4LTljMzktMjhlNzQwZTY1YWI2Cmo5", first: 9 ,includeVariations:true, sort: "name", filter: { _tags: { _expressions: [ { value: "vehicles:big-block" _operator: CONTAINS } ] } }) { edges{ node { _variation _path name type size _tags _metadata { stringArrayMetadata { name value } } } cursor } } }

 

 

 

Unless absolutely required, sort the content in GraphQL query. 

1 reply

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
November 15, 2023

hello @vineetham123 

 

Adobe has published sample queries on https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-api/sample-queries.html?lang=en#sample-filtering-tag-with-variations. It might be helpful.

 

For sorting look for "sort" keyword in following. Its sorting based on name field

 

{ enginePaginated(after: "SjkKNmVkODFmMGQtNTQyYy00NmQ4LTljMzktMjhlNzQwZTY1YWI2Cmo5", first: 9 ,includeVariations:true, sort: "name", filter: { _tags: { _expressions: [ { value: "vehicles:big-block" _operator: CONTAINS } ] } }) { edges{ node { _variation _path name type size _tags _metadata { stringArrayMetadata { name value } } } cursor } } }

 

 

 

Unless absolutely required, sort the content in GraphQL query. 

Aanchal Sikka