Lesson 5: Create Availability Rules
Your initial availability dimensions
have been created. You can now use them to create availability rules, which in turn can be applied to objects.
mutation {
# This only allows VIP users from Europe or North America to view the content between
# the 1st of January 2023 to the 1st of March 2023
vip_preview: createAvailability(availability: {
external_id: "vip-only",
start: "2023-01-01T00:00:00Z",
end: "2023-03-01T00:00:00Z",
dimensions: {
link: [
{
dimension_slug: "region",
value_slugs: ["europe", "north-america"]
},
{
dimension_slug: "customer-types",
value_slugs: ["vip"]
}
]
}
}) {
uid
}
# This only allows VIP or Standard users from Europe or North America to view the content
# from the 1st of March 2023 onwards
full_release: createAvailability(availability: {
external_id: "full-release",
start: "2023-03-01T00:00:00Z",
dimensions: {
link: [
{
dimension_slug: "region",
value_slugs: ["europe", "north-america"]
},
{
dimension_slug: "customer-types",
value_slugs: ["vip", "standard"]
}
]
}
}) {
uid
}
}
Example result (Your own UID's will be unique)
{
"data": {
"vip_preview": {
"uid": "01GSD5T2V381F7VYPJZZF894PB"
},
"full_release": {
"uid": "01GSD5T2YFS1A2TNN1V8WPP1C0"
}
}
}
Updated 7 months ago
What’s Next