Explore your schema
Learn how to interact with your GraphQL schema in Optimizely Content Management System (SaaS).
The following sections explain how to use GraphQL queries to explore the structure of your Optimizely Content Management System (SaaS) content and understand how it maps to the Optimizely Graph Schema. The provided examples let 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.
Explore your content structure
Each CMS (SaaS) instance has a unique content model. Explore the structure of your instance using the following queries:
# See all available content types (types starting with __ is 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
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
Use filters to narrow content results by type or display name.
# 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 }
}
}
}
}Updated 12 days ago
