How to
Preview scheduled CMS content
Preview scheduled and/or filtered CMS content for customers using Geins Merchant API
Prerequisites
- Merchant API key
- CMS content with future publish dates or specific filters
Goal
- Preview scheduled CMS content before it goes live
- Test content filtering based on attributes
Architecture at a glance
- Get preview token → Use token in Merchant API requests → Access scheduled/filtered CMS content
APIs used
- Merchant API:
https://merchantapi.geins.io/graphql
Step-by-step
Obtain a preview token
Log in to your Geins Merchant Center (https://{ACCOUNT_NAME}.admin.geins.io) and navigate to the CMS section. Locate the content you want to preview and choose an option under the "View" dropdown menu. You will be routed to a url with the preview token in the query parameters; ?loginToken={YOUR_PREVIEW_ACCESS_TOKEN}. Use the token for the next step.
A way of getting a preview token via Management API is under development. For now, use the Merchant Center method described above.
Use the preview token in Merchant API requests
Now that you got your token, you can use it in your Merchant API requests to preview scheduled CMS content. Use the widget area filters/parameters to preview specific content (for example, set channelId to preview content for a specific channel).
In the example below, we're previewing startpage content for desktop users who viewing prices excluding VAT.
Try it out in the GraphQL Playground using the query, headers and variables below.
Request example
query widgetArea(
$family: String = null
$areaName: String = null
$displaySetting: String = null
$preview: Boolean = null
$customerType: CustomerType
$channelId: String
$languageId: String
$marketId: String
) {
widgetArea(
family: $family
areaName: $areaName
displaySetting: $displaySetting
preview: $preview
customerType: $customerType
channelId: $channelId
languageId: $languageId
marketId: $marketId
) {
tags
containers {
layout
design
widgets {
name
configuration
images {
fileName
}
}
}
}
}
{
"Accept": "application/json",
"X-ApiKey": "{MERCHANT_API_KEY}",
"Authorization": "Bearer {YOUR_PREVIEW_ACCESS_TOKEN}"
}
{
"family": "startpage",
"areaName": "startpage-area",
"displaySetting": "desktop",
"preview": true,
"customerType": "COMPANY",
"channelId": "{CHANNEL_ID}",
"languageId": "{LANGUAGE_ID}",
"marketId": "{MARKET_ID}"
}
curl -X POST https://merchantapi.geins.io/graphql \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-ApiKey: {MERCHANT_API_KEY}" \
-H "Authorization: Bearer {YOUR_PREVIEW_ACCESS_TOKEN}" \
-d '{"query":"query widgetArea($family: String, $areaName: String, $displaySetting: String, $preview: Boolean, $customerType: CustomerType, $channelId: String, $languageId: String, $marketId: String) { widgetArea(family: $family, areaName: $areaName, displaySetting: $displaySetting, preview: $preview, customerType: $customerType, channelId: $channelId, languageId: $languageId, marketId: $marketId) { tags containers { layout design widgets { name configuration images { fileName } } } } }","variables":{"family":"startpage","areaName":"startpage-area","displaySetting":"desktop","preview":true,"customerType":"COMPANY","channelId":"{CHANNEL_ID}","languageId":"{LANGUAGE_ID}","marketId":"{MARKET_ID}"}}'
The
channelId, languageId, and marketId arguments are optional and can be left out to use default values.Response example
200 OKresponse.json
{
"data": {
"widgetArea": {
"tags": [...],
"containers": [
{
"layout": "...",
"design": "...",
"widgets": [
{
"name": "...",
"configuration": "...",
"images": [{
"fileName": "..."
}]
},
]
}
]
}
}
}
Common pitfalls
- Ensure the preview token is valid and not expired.
- Use correct widget area parameters to filter content as needed.
- Verify that the CMS content is properly scheduled and published in the CMS.
Related
Get CMS areaGet CMS menuGet CMS pageGet list of CMS pagesPreview CMS contentUse CMS area filtersUse multi-market supportWidgetArea