close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2201

Table Of Contents

4.10.9 Querying localized variants

Localized variants of any content object can be obtained using either the field localizedVariants or localizedVariant. The first will return all existing variants of a content object while the latter requires specific locale parameters in order to retrieve the variant of a specific variant.

query LocalizedVariants($path: String!) {
content {
  pageByPath(path: $path) {
    title
    type
    localizedVariants {
      ... on CMChannel {
        repositoryPath
        locale
      }
    }
    localizedVariant(language: "en", country: "us", variant: "") {
      ... on CMChannel {
        repositoryPath
        locale
      }
    }
  }
}
  }

With the locale specific approach, the parameter language is mandatory, while country and variant are optional. Please note, that if a given combination of locale parameters does not exist you may get an empty object. When skipping the parameter country however, the first variant matching the language will be returned.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.