Explore your schema
Explore your CMS 12 schema, view available content types, and test basic queries using Graph.
Use the provided GraphQL queries to explore the structure of your Content Management System (CMS) content and understand how it maps to the Optimizely Graph schema. These examples help you examine available content types, test queries, and validate filtering or search behavior. For a detailed overview of how the schema defines content relationships and field structures, see Optimizely Graph schema.
NoteAvailable content types vary depending on your CMS configuration and custom schema definitions.
Get types in your schema
Discover which content types and fields exist in your Optimizely Graph instance before you write production queries. Each instance has a unique schema, so confirming the available types prevents query errors and wasted effort.
To explore your schema, start with the following query:
# See available content types
query GetContentTypes {
__schema {
types {
name
description
}
}
}
To view the structure of a specific content type, such as ArticlePage, run the following query:
# Explore a specific content type
query ExploreArticlePage {
__type(name: "ArticlePage") {
fields {
name
type {
name
}
}
}
}
Find your content
Inventory the content that lives in your Graph instance so you know what is available to query. The following query lists content types and their total counts. Update the query with the content types available in your schema.
# Get content types and their counts
query ContentInventory {
ArticlePage { total }
StandardPage { total }
ProductPage { total }
# Add your content types here
}
Test basic queries
Validate end-to-end behavior by running small, focused queries against your live schema. Use the following patterns to confirm that retrieval and filtering work as expected before integrating queries into application code.
Run the following query to retrieve content and test your configuration.
# Simple list query
query SimpleList {
ArticlePage(limit: 3) {
items {
Name
RelativePath
}
}
}
To filter results, use a where clause.
# Query with filtering
query FilteredList {
ArticlePage(
where: { TeaserText: { contains: "Alloy" } }
limit: 5
) {
items {
Name
TeaserText
}
}
}
Updated 9 days ago
