Dynamic content item variants are locale-specific versions of a dynamic content item. To learn more, see Dynamic Content Items.

JSON Format

Dynamic Content Item Variants are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
active boolean false false If the variant is active and useable
content string false true The content of the variant
created_at string true false When the variant was created
default boolean false false If the variant is the default for the item it belongs to
id integer true false Automatically assigned when the variant is created
locale_id integer false true An active locale
outdated boolean true false If the variant is outdated
updated_at string true false When the variant was last updated
url string true false The API url of the variant

A few items are worth noting:

  • locale_id - Must be an active locale in the account. To get a list, see /api/v2/locales

  • default - Used as the fallback if Zendesk Support can't find an appropriate variant to match the locale of the user the content is being displayed for

  • outdated- Indicates the default variant for this item has been updated, but the other variants were not changed. The content may be out of date

  • active - If false, Zendesk Support will not use the variant even if the user's locale matches the variant

Example

{  "active": true,  "content": "This is my dynamic content in English",  "created_at": "2014-04-09T19:53:23Z",  "default": true,  "id": 23,  "locale_id": 125,  "outdated": false,  "updated_at": "2014-04-09T19:53:23Z",  "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"}

List Variants

  • GET /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants

Returns all the variants of the specified dynamic content item.

Allowed For

  • Admins
  • Agents who have permission to manage dynamic content

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants.json \  -v -u {email_address}:{password}

Example Response

Status 200 OK
{  "variants": [    {      "active": true,      "content": "This is my dynamic content in English",      "created_at": "2014-04-09T19:53:23Z",      "default": true,      "id": 23,      "locale_id": 125,      "outdated": false,      "updated_at": "2014-04-09T19:53:23Z",      "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"    },    {      "active": false,      "content": "Este es mi contenido dinámico en español",      "created_at": "2014-04-09T19:53:23Z",      "default": false,      "id": 24,      "locale_id": 126,      "outdated": true,      "updated_at": "2014-04-09T19:53:23Z",      "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/24.json"    }  ]}

Show Variant

  • GET /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/{dynammic_content_variant_id}

Allowed For

  • Admins, Agents

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item
dynammic_content_variant_id integer Path true The ID of the variant

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/{dynamic_content_variant_id}.json \  -v -u {email_address}:{password}

Example Response

Status 200 OK
{  "variant": {    "active": true,    "content": "C'est mon contenu dynamique en français",    "created_at": "2014-04-09T19:53:23Z",    "default": false,    "id": 23,    "locale_id": 127,    "outdated": false,    "updated_at": "2014-04-09T19:53:23Z",    "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"  }}

Create Variant

  • POST /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants

You can only create one variant for each locale id. If a locale variant already exists, the request is rejected.

Allowed For

  • Admins, Agents

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants.json \  -d '{"variant": {"locale_id": 127, "active": true, "default": false, "content": "C\u0027est mon contenu dynamique en français"}}' \  -H "Content-Type: application/json" -X POST \  -v -u {email_address}:{password}

Example Response

Status 201 Created
{  "variant": {    "active": true,    "content": "C'est mon contenu dynamique en français",    "created_at": "2014-04-09T19:53:23Z",    "default": false,    "id": 23,    "locale_id": 127,    "outdated": false,    "updated_at": "2014-04-09T19:53:23Z",    "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"  }}

Create Many Variants

  • POST /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/create_many

Allowed For

  • Admins, Agents

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/create_many.json \  -d '{"variants": [{"locale_id": 127, "active": true, "default": false, "content": "C\u0027est mon contenu dynamique en français"},{"locale_id": 126, "active": true, "default": false, "content": "Este es mi contenido dinámico en español"}]}'\  -H "Content-Type: application/json" -X POST \  -v -u {email_address}:{password}

Example Response

Status 201 Created
{  "variants": [    {      "active": true,      "content": "C'est mon contenu dynamique en français",      "created_at": "2014-04-09T19:53:23Z",      "default": false,      "id": 23,      "locale_id": 127,      "outdated": false,      "updated_at": "2014-04-09T19:53:23Z",      "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"    },    {      "active": true,      "content": "Este es mi contenido dinámico en español",      "created_at": "2014-04-09T19:53:23Z",      "default": false,      "id": 24,      "locale_id": 126,      "outdated": false,      "updated_at": "2014-04-09T19:53:23Z",      "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/24.json"    }  ]}

Update Variant

  • PUT /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/{dynammic_content_variant_id}

Updates the specified variant. You don't need to include all the properties. If you just want to update content, for example, then include just that.

You can't switch the active state of the default variant of an item. Similarly, you can't switch the default to false if the variant is the default. You must make another variant default instead.

Allowed For

  • Admins, Agents

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item
dynammic_content_variant_id integer Path true The ID of the variant

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/{dynamic_content_variant_id}.json \  -d '{"variant": {"active": false, "default": false, "content": "C\u0027est mon contenu dynamique en français"}}'\  -H "Content-Type: application/json" \  -v -u {email_address}:{password} -X PUT

Example Response

Status 200 OK
{  "variant": {    "active": false,    "content": "C'est mon contenu dynamique en français",    "created_at": "2014-04-09T19:53:23Z",    "default": false,    "id": 23,    "locale_id": 125,    "outdated": false,    "updated_at": "2014-04-09T19:53:23Z",    "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"  }}

Update Many Variants

  • PUT /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/update_many

Updates one or more variants. See Update Variant.

You must specify the variants by id in the body. To get the variant ids, see List Variants.

Allowed For

  • Admins, Agents

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/update_many.json \  -d '{"variants": [{"id": 2789787, "locale_id": 16, "active": true, "default": false, "content": "C\u0027est mon contenu dynamique en français"},{"id": 2789807, "locale_id": 2, "active": true, "default": false, "content": "Este es mi contenido dinámico en español"}]}'\  -H "Content-Type: application/json" -X POST \  -v -u {email_address}:{password}

Example Response

Status 200 OK
{  "variants": [    {      "active": true,      "content": "C'est mon contenu dynamique en français",      "created_at": "2014-04-09T19:53:23Z",      "default": false,      "id": 23,      "locale_id": 16,      "outdated": false,      "updated_at": "2014-04-09T19:53:23Z",      "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/23.json"    },    {      "active": true,      "content": "Este es mi contenido dinámico en español",      "created_at": "2014-04-09T19:53:23Z",      "default": false,      "id": 24,      "locale_id": 2,      "outdated": false,      "updated_at": "2014-04-09T19:53:23Z",      "url": "https://subdomain.zendesk.com/api/v2/dynamic_content/items/3/variants/24.json"    }  ]}

Delete Variant

  • DELETE /api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/{dynammic_content_variant_id}

Allowed For

  • Admins, Agents

Parameters

Name Type In Required Description
dynamic_content_item_id integer Path true The ID of the dynamic content item
dynammic_content_variant_id integer Path true The ID of the variant

Using curl

curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}/variants/{dynamic_content_variant_id}.json \  -X DELETE -v -u {email_address}:{password}

Example Response

Status 204 No Content