Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM GraphQL Integration

Avatar

Level 3

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

hello @vineetham123 

 

Adobe has published sample queries on https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap.... 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

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

hello @vineetham123 

 

Adobe has published sample queries on https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap.... 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