VariantGroups

View as Markdown

VariantGroups

Variants in Contentstack provides an overview of variant groups and linked content types, which are used for content personalization. Linking content types to variant groups allows you to create entry variants.

Find

The Find Variant Groups returns a list of all variant groups linked to your stack.

NameTypeDescription
collectionParameterCollection

Query parameter collection

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").VariantGroups().Find();

FindAsync

The FindAsync Variant Groups returns a list of all variant groups linked to your stack.

NameTypeDescription
collectionParameterCollection

Query parameter collection

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").VariantGroups().Find();

LinkContentTypes

The LinkContentTypes method allows you to link content types to your variant group.

NameTypeDescription
contentTypeUids (required)List<string>

List of content type UIDs to be linked to the variant group

collectionParameterCollection

Query parameter collection

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
List<string> contentTypeUids = new List<string> { "content_type_uid_1", "content_type_uid_2" };
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").VariantGroups("<VARIANT_GROUP_UID>").LinkContentTypes(contentTypeUids);

LinkContentTypesAsync

The LinkContentTypesAsync method allows you to link content types to your variant group.

NameTypeDescription
contentTypeUids (required)List<string>

List of content type UIDs to be linked to the variant group

collectionParameterCollection

Query parameter collection

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
List<string> contentTypeUids = new List<string> { "content_type_uid_1", "content_type_uid_2" };
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").VariantGroups("<VARIANT_GROUP_UID>").LinkContentTypesAsync(contentTypeUids);

UnlinkContentTypes

The UnlinkContentTypes method allows you to unlink content types to your variant group.

NameTypeDescription
contentTypeUids (required)List<string>

List of content type UIDs to be linked to the variant group

collectionParameterCollection

Query parameter collection

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
List<string> contentTypeUids = new List<string> { "content_type_uid_1", "content_type_uid_2" };
ContentstackResponse contentstackResponse = client.Stack("<API_KEY>").VariantGroups("<VARIANT_GROUP_UID>").UnlinkContentTypes(contentTypeUids);

UnlinkContentTypesAsync

The UnlinkContentTypesAsync method allows you to unlink content types to your variant group.

NameTypeDescription
contentTypeUids (required)List<string>

List of content type UIDs to be linked to the variant group

collectionParameterCollection

Query parameter collection

using Contentstack.Management.Core;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
List<string> contentTypeUids = new List<string> { "content_type_uid_1", "content_type_uid_2" };
ContentstackResponse contentstackResponse = await client.Stack("<API_KEY>").VariantGroups("<VARIANT_GROUP_UID>").UnlinkContentTypesAsync(contentTypeUids);