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

What's the GraphQL query to get data based on variation in GraphQL ?

Avatar

Level 5

Hi team, I am using GraphQL API in AEM and wanted to know how can I query variation based data from a content fragment?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @spidey1405,

I think you can do something like this:

{
  cityList (variation: "variation_name") {
    items {
      _path
      name
      country
      population
      categories
    }
  }
}

Under below page you will find more sample queries (including variation usage) that could be useful:

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @spidey1405,

I think you can do something like this:

{
  cityList (variation: "variation_name") {
    items {
      _path
      name
      country
      population
      categories
    }
  }
}

Under below page you will find more sample queries (including variation usage) that could be useful:

Avatar

Level 5

@lukasz-m 

I am writing this query:

query {
  articlesList(variation:"Spanish") {
    items {
      _path,
      title,
      
    }
  }
}

but this still gives me master version only.

 

Okay a slight correction, your variation must be lower cased and spaces should be replaced with _ and then it should work fine.

Here are some examples:

Variation Name: Variation 01
then in query it must be `variation:"variation_01"`