Third party orchestration
Last Modified Date: 09.05.2023
What is Third party orchestration?
The Third party orchestration feature allows you to resolve content referenced from other product information systems using the Contentful GraphQL API.
EAP goals
As part of the early access program we aim to:
Refine the developer experience when using Third party orchestration. We want to improve developer productivity by doing the heavy lifting of connecting content from everyday systems used for creating engaging digital experiences.
Provide a way to control what content developers receive in the delivery time.
Access Third party orchestration
Use the sign-up form to be included in the EAP. Once you are selected, we will enable Third party orchestration for your organization.
Use Third party orchestration
Currently, the Third party orchestration feature only supports integration with Shopify.
With Shopify integration, Third party orchestration resolves links to Shopify Products that were created using the Shopify App.
We enabled an integration between Contentful and Shopify in our GraphQL API which allows for streamlined access to data from both systems with a single request. The integration adds a new field to the source Type with a __data
suffix, that is specifically designed to establish a connection to Shopify data. This field serves as a link, bridging the gap between the Contentful Type and the underlying Shopify Product.
At present, we support an integration on fields linked to the following Shopify entities:
type TopicProduct implements Entry {
sys: Sys!
(...)
shopifyProduct(locale: String): String
shopifyProduct__data: Shopify_Product
}
Authentication
For authenticating calls to the Shopify Storefront API, we use the token that is configured in the Shopify App.
Technical and query complexity limits
- Only GraphQL support.
- Only references to
Shopify.Product
andShopify.Collection
. - Queries towards Shopify are not counted against complexity limits during the EAP.
- Rate limits of the respective platform are applied.
Get started with Shopify orchestration
Step 1: Enable Third party orchestration EAP
Sign-up using our EAP Form to enable Third party orchestration for your Organization.
Step 2: Reference Shopify Product
Follow the steps defined in the installation instructions to install and configure the Shopify App into the target environment.
Step 3: Use GraphQL API to query Shopify Product information
Open your preferred GraphQL client or use an online IDE, such as GraphiQL or GraphQL Playground.
Insert the following GraphQL query as an example, replacing "ENTRY_ID" with the ID of the product you want to query:
{
topicProduct(id: "ENTRY_ID") {
sys {
id
spaceId
}
shopifyProduct
shopifyProduct__data {
title
description
}
}
}
Run the query and you should receive a JSON response containing the product details, such as title
and description
:
{
"data": {
"topicProduct": {
"sys": {
"id": "dzpSfj0LhgtldEHkwFxMV",
"spaceId": "8tlo7deo9l8e"
},
"shopifyProduct": "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzgxMDg5MDY2NzY1NDA=",
"shopifyProduct__data": {
"title": "Long sleeve t-shirt",
"description": "A long sleeve t-shirt is a classic and versatile piece of clothing that provides comfort and style. With its long sleeves, it offers additional coverage and warmth compared to a traditional t-shirt. Made from soft and breathable fabric, this t-shirt is perfect for layering or wearing on its own. It is available in various colors and sizes, making it suitable for everyone's personal taste and style."
}
}
}
}
You can also use the JavaScript example provided in the original input to query Shopify Products directly from the Contentful GraphQL API. Make sure to replace 'YOUR_CDA_TOKEN' and 'YOUR_SPACE_ID' with your respective access token and space ID.
const access_token = 'YOUR_CDA_TOKEN';
const spaceId = 'YOUR_SPACE_ID';
const productQuery =
/* GraphQL */
`
{
topicProduct(id: "dzpSfj0LhgtldEHkwFxMV") {
sys {
id
spaceId
}
shopifyProduct
shopifyProduct__data {
title
description
}
}
}
`;
const requestOptions = {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
Authorization: `Bearer ${access_token}`,
}),
body: JSON.stringify({
query: productQuery,
}),
};
fetch(
`https://graphql.contentful.com/content/v1/spaces/${spaceId}`,
requestOptions
)
.then((response) => response.json())
.then((result) => console.log(JSON.stringify(result, null, 2)))
.catch((error) => console.log('error', error));
Explore the schema with GraphiQL
You can explore and inspect the schema of a space using GraphiQL, an in-browser GraphQL IDE (integrated development environment).
To open the GraphiQL server visit the https://graphql.contentful.com/content/v1/spaces/{SPACE}/explore?access_token={CDA_TOKEN}
URL in your browser.
Third-party orchestration is in early preview and is NOT a supported Contentful product yet. To find help please ask a question in Contentful Community #help channel. If you are part of the Early Access Program, you will be provided with direct contacts in your welcome email.