Documentation Center

GraphQL request for getting both Publications and Pages using one query

Using multiple item types in your query, you can fetch Publications and Pages in one go.

In this example, the query returns Publications and Pages that are either associated with a specific product release, or that have a specific set of three custom metadata key-value pairs:
{
  items(
    filter: {
      # Return Publications and Pages
      itemTypes: [PUBLICATION, PAGE],
      # Only return content published from Tridion Docs
      namespaceIds: [2],
      or: [
        # Either the returned item itself must be associated with a specific product release...
        { customMeta: { key: "FMBPRODUCTRELEASENAME.version.element", value: "9019"}},
        # ...or the returned item must be in a Publication associated with a specific product release, 
        # and additionally the returned item itself must have the Taxonomy Keyword with ID 9006, and be in English.
        { and: [
            { customMeta: {scope: Publication, key: "FMBPRODUCTRELEASENAME+version+element", value: "9019"} }
            { customMeta: {key: "FMBCONTENTREFTYPE+logical+element", value: "9006"} },
            { customMeta: {key: "DOC-LANGUAGE+lng+value", value: "en"} },
          ]
        }
      ]
    }
  ) {
    edges {
      node {
        id
        publicationId
        namespaceId
        itemId
        itemType
        title

        ... on Page {
          url
          containerItems {
            ...on ComponentPresentation {
              rawContent {
                data
              }
            }
          }
        }
      }
    }
  }
}