close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2512.1

Table Of Contents

4.10.10.3 Retrieving Properties Uniformly

Retrieving properties for both the baseline and all variants at the same time can result in complex queries when the previous approach is used, because property names have to be specified twice. This is particularly verbose, if multiple accesses to variants are nested.

{
  content {
    page(id: "123456") {
      id
      name
      teaserTitle
      teaserText {
        text
      }
      contentVariants {
        content {
          id
          name
          ... on CMChannel {
            teaserTitle
            teaserText {
              text
            }
          }
        }
        conditionStrings
      }
    }
  }
}

To simplify such situations, both the variants and the baseline itself can be requested in a single collection contentVariantsAndBaseline:

{
  content {
    page(id: "123456") {
      contentVariantsAndBaseline {
        content {
          id
          name
          ... on CMChannel {
            teaserTitle
            teaserText {
              text
            }
          }
        }
        conditionStrings
      }
    }
  }
}

This results in:

{
  "data": {
    "content": {
      "page": {
        "contentVariantsAndBaseline": [
          {
            "content": {
              "id": "345678",
              "name": "Variant Page",
              "teaserTitle": "Variant Home",
              "teaserText": "Home Variant Home"
            },
            "conditionStrings": [
              "cmec:///p13n/segment/12345678901234567890;cmecType=segment"
            ]
          },
          {
            "content": {
              "id": "123456",
              "name": "The Page",
              "teaserTitle": "Home",
              "teaserText": "Home Sweet Home"
            },
            "conditionStrings": null
          }
        ]
      }
    }
  }
}

For contentVariantsAndBaseline the baseline always comes last in the list, because it has a lower priority than all variants, which are ordered by descending priority. Unlike the variants, the baseline has null values for the properties conditions and conditionStrings, indicating that no conditions have to be checked.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

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