Filter content to get what you need
Is this page helpful?
system.id
) against the ID value you have.
equals
filter.
To ensure you get content in a specific language, use the language
parameter in your requests.
product_All
.containsAny
or containsAll
filters.system
properties of the content item object. For example, system.workflow_step
, system.collection
, system.last_modified
.# Gets an item by its internal ID
query GetArticleById {
article_All(where: {_system_: {id: {eq: "2f7288a1-cfc8-47be-9bf1-b1d312f7da18"}}}) {
items {
title
}
}
}
# Gets three articles by their codenames. Use GraphQL aliases to retrieve multiple items of the same type.
query GetArticlesByCodenames {
helloWorldArticle: article(codename: "hello_world") {
title
}
getContentArticle: article(codename: "get_content") {
title
}
filterContentArticle: article(codename: "filter_content") {
title
}
}
# Gets items based on the type Product
query GetItemsByType {
product_All { # Root collection query specifies the content type
items {
price
}
}
}
# Gets items based on the types Product, Article, and News
query GetItemsByTypes {
product_All { # Root collection query for Product means you'll get items based on the Product content type
items {
name
}
}
article_All { # Root collection query for Article means you'll get items based on the Article content type
items {
title
}
}
news_All { # Root collection query for News means you'll get items based on the News content type
items {
title
}
}
}
# Gets articles modified after November 1 2021, 9 am UTC+0
query GetArticlesModifiedAfterDate {
article_All (where: {_system_: {lastModified: {gt: "2021-11-01T09:00:00Z"}}}) {
items {
title
}
}
}
# Gets articles released at or after November 1 2021, 9 am UTC+0
query GetArticlesReleasedAfterDate {
article_All (where: {releaseDate: {gte: "2021-11-01T09:00:00Z"}}) {
items {
title
}
}
}
# Gets articles modified before November 1 2021, 12 pm UTC+0. Last match would be at 2021-10-31T:11:59:59
query GetArticlesModifiedBeforeDate {
article_All (where: {_system_: {lastModified: {lt: "2021-11-01T00:00:00Z"}}}) {
items {
title
}
}
}
# Gets articles released at or before November 1 2021, 9 am UTC+0
query GetArticlesReleasedAfterDate {
article_All (where: {releaseDate: {lte: "2021-11-01T09:00:00Z"}}) {
items {
title
}
}
}
# Gets articles whose Title element value equals to "Hello World"
query GetArticleByTitle {
article_All(where: {title: {eq: "Hello World"}}) {
items {
title
}
}
}
# Note: Filters work with codenames. This means codenames of the taxonomy terms or multiple choice options.
# Gets items tagged with one specific tag
query GetArticlesTaggedWithATerm {
article_All(where: {topic: {containsAny: ["kontent_ai"]}}) {
items {
title
}
}
}
# Gets items tagged with a list of specific tags
query GetArticlesTaggedWithTerms {
article_All(where: {topic: {containsAll: ["kontent_ai", "cms"]}}) {
items {
title
}
}
}
# Gets items tagged with at least one tag from the list
query GetArticlesTaggedWithOneOfTerms {
article_All(where: {topic: {containsAny: ["headless", "cms"]}}) {
items {
title
}
}
}
# Gets items whose URL slug equals to sample-url-slug
query GetArticlesByUrlSlug {
article_All(where: {url: {eq: "sample-url-slug"}}) {
items {
title
}
}
}
# Gets items attributed to Jane.
query GetArticlesByAuthor {
article_All(where: {author: {containsAll: ["jane_doe"]}}) {
items {
title
}
}
}
# Gets items attributed to at least Jane, John, or both.
query GetArticlesByOneOfAuthors {
article_All(where: {author: {containsAny: ["jane_doe", "john_wick"]}}) {
items {
title
}
}
}
# Gets pages linking travel insurance as their subpage.
query GetArticlesTaggedWithATerm {
article_All(where: {subpages: {containsAll: ["travel_insurance"]}}) {
items {
title
}
}
}
# Gets pages linking at least travel insurance, car insurance, or both as their subpage.
query GetArticlesTaggedWithTerms {
article_All(where: {subpages: {containsAny: ["travel_insurance", "car_insurance"]}}) {
items {
title
}
}
}