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?
Solved! Go to Solution.
Views
Replies
Total Likes
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.
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.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies