Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Content base types

Describes content base and contract types registered in the GraphQL schema for querying content in Optimizely CMS (SaaS).

Optimizely Content Management System (SaaS) registers a set of base and contract types in the Optimizely Graph's GraphQL schema, which user-defined content types inherit from. You can use these base types to query your content in Optimizely Graph.

📘

Note

A note regarding breaking changes in the schema. Fields in these base and contract types may be deprecated, but are never removed or their types are never changed unless a new major version of Optimizely Graph is released. New fields may be added and new types may be added to the types field defined in IContentMetadata.

Type hierarchy in the Optimizely Graph schema

The following diagram illustrates the type hierarchy in Optimizely Graph schema, specifically focusing on how user-defined content types in CMS (SaaS) relate to the base and contract types. Understanding this hierarchy helps you create structured content types and enables consistent querying using Optimizely Graph.

flowchart BT
    u1([NewsPage]) --> _Page
    u2([BlankExperience]) --> _Experience --> _Page
    u3([TeaserBlock]) --> _Component
    u4([HeadingElement]) --> _Component
    u5([BlankSection]) --> _Section --> _Component
    u6([ImageMedia]) --> _Image --> image(_ImageItem) --> _Media
    u7([VideoMedia]) --> _Video --> _Media
    u8([GenericMedia]) --> _Media

    _Page --> _Content
    _Component --> _Content
    _Folder --> _Content
    _Media --> asset(_AssetItem) --> _Content

    _Content --> item(_Item)
  • Global contracts (rounded) – These are the predefined system types that serve as parent types for various base types across multiple sources, not just from the CMS. Global contracts are prefixed with an underscore (_) and represented by boxes with rounded corners. See which metadata fields these types define.
  • Base types (squares) – These are the predefined system types that serve as parent types for various content categories. Base types are prefixed with an underscore (_) and represented by square boxes. See which metadata fields these types define.
  • User-defined content types (stadium-shaped) – Custom content types created by developers in CMS (SaaS). See Manage content types from the UI or Manage content types using the REST API. They inherit from the corresponding base types and are represented by stadium-shaped boxes.
    For example;
    • a news article type (NewsPage) might inherit from _Page.
    • a small section of a webpage designed to capture a user's attention by providing a brief preview of content (TeaserBlock) might inherit from _Component (block).
    • both _Page and _Component inherit from _Content.

Example queries

📘

Note

Predefined system types are prefixed with _ to distinguish them from user-defined content types.

The base types can be used to query over sets of content types. To query overall content types, you can use the common base type _Content.

query AcrossAllContent {
  _Content {
    items {
      _metadata {
        displayName
      }
    }
  }
}

To search over content types of a specific base type, like Image, then you can use the base type _Image.

query AcrossAllImages {
  _Image {
    items {
      _metadata {
        displayName
      }
    }
  }
}