Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Explore your schema

Learn how to interact with your GraphQL schema in Optimizely Content Management System (SaaS).

Use GraphQL queries to inspect your Optimizely Content Management System (SaaS) content and confirm how it maps to the Optimizely Graph schema. The examples in this article let you list available content types, count items per type, and validate filtering and search behavior before you build production queries. For a detailed reference on schema relationships and field structures, see Optimizely Graph schema.

Explore your content structure

Each CMS (SaaS) instance has a unique content model. Run the following queries to list the available content types and retrieve sample items for any type in your instance.

# See all available content types (types starting with __ are internal GraphQL types)
query GetContentTypes {
  __schema {
    types {
      name
      description
      kind
    }
  }
}

# Get content by type
query ExploreContent {
  _Content(
    where: { _metadata: { types: { in: ["LandingPage"] } } }
    limit: 5
  ) {
    items {
      _metadata {
        displayName
        types
        url { default }
      }
    }
  }
}

Find your content types

Use a content-inventory query to confirm which content types are populated in your instance and how many items each one contains. This check helps you decide which types to target in downstream queries.

Run the following query to see the total number of content items for each content type.

# Get all content types and their counts
query ContentInventory {
  LandingPage { total }
  BlogPostPage { total }
  _Content { total }
}

Test filters and search

Filters narrow content results by type or display name so you can validate query shape before integrating it into an application. Use the following queries to confirm that your filter and search inputs return the expected items.

# Filter by content type
query FilterByType {
  _Content(
    where: { 
      _metadata: { 
        types: { in: ["LandingPage", "BlogPostPage"] } 
      } 
    }
    limit: 10
  ) {
    items {
      _metadata {
        displayName
        types
        url { default }
      }
    }
  }
}

# Search by display name
query SearchContent {
  _Content(
    where: { 
      _metadata: { 
        displayName: { contains: "Mosey" } 
      } 
    }
    limit: 5
  ) {
    items {
      _metadata {
        displayName
        types
        url { default }
      }
    }
  }
}