Skip to content
Jetrepo
Esc
navigateopen⌘Jpreview
On this page

Structured fields

Query relations, Components, and Taxonomy in GraphQL and REST.

GraphQL resolves structured fields as typed objects. REST keeps Reference, Asset, and Taxonomy values as IDs while projecting Components inline.

Access

Delivery keys have Backend scope only. In Preview, content.read gates Data Types and locales, while term.read gates Vocabularies and Term locales. A stored reference never grants access to its target.

GraphQL projection

query ArticleGraph($id: ID!) {
  article(id: $id) {
    _id
    author {
      _id
      name
    }
    related {
      _id
      title
    }
    seo {
      title
      description
    }
    hero {
      _id
      file {
        url
        mimeType
        originalName
      }
    }
    category {
      _id
      key
      label
      vocabularyKey
    }
  }
}

A missing or restricted single reference resolves to null. Do not infer target content or metadata from an unresolved reference.

Components are inline value objects and use the root locale. They have no _id or lifecycle metadata. Asset files and Taxonomy Terms have their own generated object shapes.

Taxonomy roots

For a Vocabulary key productCategories, GraphQL generates:

query TaxonomyExamples {
  one: taxonomy_productCategories(id: "TERM_ID") {
    _id
    key
    label
    breadcrumb {
      key
      label
    }
  }
  all: taxonomy_productCategories_all(first: 25) {
    items {
      _id
      key
      label
    }
    page_info {
      end_cursor
    }
  }
  children: taxonomy_productCategories_children(parent: "PARENT_TERM_ID") {
    items {
      _id
      key
      label
    }
  }
}

Term custom-field filters and sorts are generated only for eligible top-level, single-valued scalar fields.

REST projection

{
  "_id": "ARTICLE_ID",
  "author": "AUTHOR_ID",
  "related": ["ARTICLE_2", "ARTICLE_3"],
  "seo": { "title": "Example", "description": "Summary" },
  "hero": "ASSET_ID",
  "category": "TERM_ID"
}

REST has no populate or expand option. Use GraphQL when the response must include related records.

GraphQL query depth is at most 12.

Was this page helpful?