How to
Get CMS area
Retrieve a CMS area by family and area name using Geins Merchant API
Prerequisites
- Merchant API key
- An existing CMS family with at least one area
Goal
- Retrieve a page's widget collection by specifying
familyandareaName
Architecture at a glance
- Call
widgetAreawithfamilyandareaName→ Receive area containing containers and widgets
Example
Use family and areaName to fetch a known area.
Try it out in the GraphQL Playground using the query, headers and variables below.
Request example
query widgetArea(
$family: String
$areaName: String
$channelId: String
$languageId: String
$marketId: String
) {
widgetArea(
family: $family
areaName: $areaName
channelId: $channelId
languageId: $languageId
marketId: $marketId
) {
tags
containers {
layout
design
widgets {
name
configuration
images { fileName }
}
}
}
}
{
"Accept": "application/json",
"X-ApiKey": "{MERCHANT_API_KEY}"
}
{
"family": "{CMS_FAMILY}",
"areaName": "{CMS_AREA_NAME}",
"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}" \
-d '{"query":"query widgetArea($family: String, $areaName: String, $displaySetting: String, $channelId: String, $languageId: String, $marketId: String) { widgetArea(family: $family, areaName: $areaName, displaySetting: $displaySetting, channelId: $channelId, languageId: $languageId, marketId: $marketId) { tags containers { layout design widgets { name configuration images { fileName } } } } }","variables":{"family":"{CMS_FAMILY}","areaName":"{CMS_AREA_NAME}","displaySetting":"desktop","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": ["startpage"],
"containers": [
{
"layout": "full",
"design": "default",
"widgets": [
{
"name": "Banner",
"configuration": "{...}",
"images": [{"fileName": "image.jpg"}]
}
]
}
]
}
}
}
Options
Read more about filtering options in the "how to"-article about using CMS area filters.
Channel, Language, and Market
The query also supports optional parameters for multi-market support:
Read more about
channelId, languageId, and marketId in the "how to"-article about using multi-market support.Authenticated access
While authentication is not required for this query, including a JWT bearer token in the Authorization header can provide personalized results based on the authenticated user's context, for example personalized or restricted content.
To include authentication, add the JWT bearer token to your request headers:
"Authorization": "Bearer {JWT_TOKEN}"
Read more about obtaining and using JWT tokens in the guide about the authentication flow.
Related
Get CMS areaGet CMS menuGet CMS pageGet list of CMS pagesPreview CMS contentUse CMS area filtersUse multi-market supportWidgetArea