Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Not to Return default Master variation in Graphql response

Avatar

Level 3

I have a content fragment having set of variations. I have written a graphql query to get the content fragment data for a given variation. The problem is graphql returns the master variation data as default if the specified variation is not available.

Ideally , I should be expecting empty response if the given variation doesn't exists.

Is there any possibility  to avoid getting master variation data in response as default ?

2 Replies

Hy @Saravanan_Dharmaraj , The above mentioned post talks about using the list query in which  we can apply filters and we only get those result sets. I am talking about using content fragment by path query. where I will be passing the path of the content fragment and the required variation. The problem is if the particular variation doesn't exist Adobe documentation says we will get master variation as default fallback which can be misleading.

I want to avoid getting fallback master variation response in path based query.

 

query {
  article(variation:"spanish", _path:"/path/to/article/contentfragment") {
    item {
      _path,
      title,
      
    }
  }
}