GraphQL request for fetching Tridion Docs topics tagged with Keywords from a Tridion Sites Taxonomy
To execute a mashup scenario, fetch Tridion Docs content that has the same Taxonomy Keyword as some Tridion Sites content, then combine the two on a webpage.
In this example, content is fetched with several custom metadata key-value pairs. One of these key-value pairs represents a Taxonomy Keyword shared across Tridion Docs and Tridion Sites. The query is as follows:
{
items (
filter: {
itemTypes: [PAGE],
and: [
# Content tagged with the Tridion Sites Taxonomy Keyword with ID 9006
{ customMeta: {key: "FMBCONTENTREFTYPE+logical+element", value: "9006"} },
# Content in English
{ customMeta: {key: "DOC-LANGUAGE+lng+value", value: "en"} },
# Content within a Publication tagged a product release ID 9019
{ customMeta: {scope:Publication, key: "FMBPRODUCTRELEASENAME+version+element", value: "9019"} }
]
}
) {
edges {
node {
id
publicationId
namespaceId
itemId
itemType
title
... on Page {
url
containerItems {
... on ComponentPresentation {
rawContent {
data
}
}
}
}
}
}
}
}
Here is the kind of response you can expect to get back from this query (where HTMLFRAGMENT is the raw, properly escaped HTML content of a published item):
{
"data": {
"items": {
"edges": [
{
"node": {
"id": "4c5bdede-54b2-3785-a2ac-70a90b2c48e5",
"publicationId": 3059467,
"namespaceId": 2,
"itemId": 164379,
"itemType": 64,
"title": "Launching a game",
"url": "3059467/164379/user-guide/launching-a-game",
"containerItems": [
{
"rawContent": {
"data": {
"Component": {
"Id": "ish:3059467-164379-16",
"Title": null,
"CustomProperties": {},
"ExtensionData": null,
"RevisionDate": "2018-06-08T09:19:40.999",
"Publication": {
"Id": "ish:0-3059467-1",
"Title": "User Guide",
"CustomProperties": {},
"ExtensionData": null
},
"OwningPublication": {
"Id": "ish:0-3059467-1",
"Title": "User Guide",
"CustomProperties": {},
"ExtensionData": null
},
"Folder": {
"Id": "ish:3059467-164379-2",
"Title": "Home",
"CustomProperties": {},
"ExtensionData": null,
"PublicationId": "ish:0-3059467-1"
},
"LastPublishedDate": "2018-06-08T09:19:40.999",
"Version": 0,
"MetadataFields": null,
"Categories": null,
"Schema": {
"Id": "ish:3059467-1-8",
"Title": "Topic",
"CustomProperties": {},
"ExtensionData": null,
"RevisionDate": null,
"Publication": null,
"OwningPublication": null,
"Folder": null,
"LastPublishedDate": null,
"Version": 0,
"MetadataFields": null,
"Categories": null,
"Schema": null,
"RootElementName": "Topic"
},
"ComponentType": "NORMAL",
"Fields": {
"topicTitle": {
"Name": "topicTitle",
"Values": [
"Launching a game"
],
"NumericValues": null,
"DateTimeValues": null,
"LinkedComponentValues": null,
"KeywordValues": null,
"EmbeddedValues": null,
"FieldType": 0,
"XPath": null,
"CategoryId": null,
"CategoryName": null
},
"topicBody": {
"Name": "topicBody",
"Values": [ "HTMLFRAGMENT" ],
"NumericValues": null,
"DateTimeValues": null,
"LinkedComponentValues": null,
"KeywordValues": null,
"EmbeddedValues": null,
"FieldType": 1,
"XPath": null,
"CategoryId": null,
"CategoryName": null
}
},
"Multimedia": null,
"EclId": null
},
"ComponentTemplate": {
"Id": "ish:3059467-164379-32",
"Title": "Topic",
"CustomProperties": {},
"ExtensionData": null,
"RevisionDate": "2018-06-08T09:19:40.999",
"Publication": null,
"OwningPublication": null,
"Folder": null,
"LastPublishedDate": null,
"Version": 0,
"MetadataFields": {
"view": {
"Name": "view",
"Values": [
"Ish:Topic"
],
"NumericValues": null,
"DateTimeValues": null,
"LinkedComponentValues": null,
"KeywordValues": null,
"EmbeddedValues": null,
"FieldType": 0,
"XPath": null,
"CategoryId": null,
"CategoryName": null
}
},
"Categories": null,
"Schema": null,
"OutputFormat": "REL"
},
"ExtensionData": null,
"IsDynamic": true,
"RenderedContent": null,
"OrderOnPage": 0,
"Conditions": null
}
}
}
]
}
}
]
}
}
}