GraphQL samples
This section contains a large collection of GraphQL request samples, to illustrate a variety of common query scenarios.
- GraphQL request for getting a Publication mapping from its URL
If you know the URL of a published Publication, you can retrieve its Publication mapping (which includes the ID of the Publication). - 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 executing simple searches
Several samples illustrate how a simple search string entered by your visitor can be put in a GraphQL request. - 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.
Related reference