GraphQL samples
This section contains a large collection of GraphQL request samples, to illustrate a variety of common query scenarios.
- GraphQL requests for getting Publication mappings
Various queries let you retrieve Publication mappings. - GraphQL request to get the Component Presentations on a Page
Use thecontainerItemsfield in your Public Content API call to fetch all the Component Presentations on a specific Page. - GraphQL requests related to linking
The sample requests in this section are related to resolving, getting and rendering links. - GraphQL request to apply merged conditions
Use thecontextDataparameter in a query to pass conditions. In a content query, add this parameter to acomponentPresentation()orpage()query; in a Taxonomy query, add this parameter to akeyword()orcategories()call. - GraphQL requests using the items() field
This section contains a number of sampleitems()calls to demonstrate how to query content from Tridion Sites, Tridion Docs or both. - GraphQL requests using the componentPresentations() field
Use thecomponentPresentations()field to query Component Presentations specifically. This type of query is similar to theitems()query. - GraphQL requests involving custom metadata filtering
This series of samples demonstrates the use of scope while filtering on custom metadata. - GraphQL requests working with typed custom metadata
If you, as an implementer, are aware of the typology and design of metadata in your Components and Pages, you can use this knowledge to create much more targeted metadata queries. - GraphQL requests executing simple searches
Several samples illustrate how a simple search string entered by your visitor can be put in a GraphQL request. - GraphQL request querying metadata fields
You can perform a search by querying metadata fields. - GraphQL requests using Boolean expressions with more than two operands
UsegroupByto combine a two-operand Boolean expression with a third operand, to form a three-operand Boolean expression. - GraphQL sample for search suggestions
Use search suggestions to suggest values while the visitor is typing. Fuzzy search is supported for this feature. - Recommendations GraphQL samples
The samples in this section start out simple and become more sophisticated with each subsequent sample. In this way, the samples take you on an implementation journey, where each new samples refines the previous one.
Related reference