Dynamic Content Items
Dynamic content is a combination of a default version of some text and variants of the text in other languages. The combined content is represented by a placeholder such as {{dc.my_placeholder}}. Dynamic content is available only on the Professional plan and above. Learn more in the Support Help Center.
This page contains the API reference for dynamic content items. See Dynamic Content Item Variants for the reference for variants.
You can use dynamic content with the API to set some properties of ticket fields, ticket forms, user fields, and organization fields. For example, you can use dynamic content for the title of a ticket field. In that case, use the dynamic content placeholder for the value of the field's raw_title
property and the the default version of the text as the value of the title
property. Example:
"title": "Flight Number", "raw_title": "{{dc.my_field_title}}", ...
If dynamic content is not used for the property, the two values are identical:
"title": "Flight Number", "raw_title": "Flight Number", ...
Data hierarchy
The data structure for dynamic content is a parent-child hierarchy where variants belong to items.
-
Items
These are the dynamic content placeholders defined by content creators. Each item defines a namespace for a specific piece of content, such as instructions on how to reset your password or upgrade your plan. An item's only content is the title of the item itself (defined by you) and a placeholder for that item (defined by Zendesk Support). The content itself is contained in the variants.
-
Variants
These are pieces of locale-specific content, where the context is based on the item they belong to. You can only have one variant per locale, per item. For example, if an item has 3 variants, they must each have a unique locale such as English, Spanish and French. They can't be English, English, and Spanish (though it is possible to have English-US and English-UK).
Each item has a unique ID and a unique dynamic content placeholder. Below each item are a number of variants, all with their unique ID and locale. Items can contain any number of variants.
Paginating and sorting
This API uses standard pagination and sorting parameters. See Pagination.
You can sort the results of any list endpoint (both asc and desc) by the following properties: locale
, outdated
, active
, updated_at
, and created_at
. The default sorting is by id
in descending order.
Specifying item variants
When creating or updating an item, specify the variants in the item's variants
array. Each variant consists of a locale_id
, default
, and content
property. See Dynamic Content Item Variants for the variants API reference.
Zendesk Support uses the default
variant if it can't find a variant that matches the user's locale.
Example, formatted for clarity:
{
"item": {
"name": "Snowboard Problem",
"default_locale_id": 1,
"variants": [
{"locale_id": 1, "default": true, "content": "C'est mon contenu dynamique en français"},
{"locale_id": 2, "default": false, "content": "Este es mi contenido dinámico en español"}
]
}
}
If you have only one variant, you can use the content
property instead of the variants
property:
{
"item": {
"name": "Snowboard Problem",
"default_locale_id": 1,
"content": "C'est mon contenu dynamique en français"
}
}
However, we recommend passing an array of variants even if you only have one variant.
JSON format
Dynamic Content Items are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | true | false | When this record was created |
default_locale_id | integer | false | true | The default locale for the item. Must be one of the locales the account has active. |
id | integer | true | false | Automatically assigned when creating items |
name | string | false | true | The unique name of the item |
outdated | boolean | true | false | Indicates the item has outdated variants within it |
placeholder | string | true | false | Automatically generated placeholder for the item, derived from name |
updated_at | string | true | false | When this record was last updated |
url | string | true | false | The API url of this item |
variants | array | false | true | All variants within this item. See Dynamic Content Item Variants |
List Items
GET /api/v2/dynamic_content/items
Returns a list of all dynamic content items for your account if accessed as an admin or agents who have permission to manage dynamic content.
Allowed For
- Admins, Agents
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/dynamic_content/items"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/dynamic_content/items")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/dynamic_content/items',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/dynamic_content/items"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/dynamic_content/items")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"items": [
{
"created_at": "2015-05-13T22:33:12Z",
"default_locale_id": 1,
"id": 47,
"name": "Snowboard Problem",
"outdated": true,
"placeholder": "{{dc.snowboard_problem}}",
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47.json",
"variants": [
{
"active": true,
"content": "C'est mon contenu dynamique en français",
"created_at": "2015-05-13T22:33:12Z",
"default": true,
"id": 47,
"locale_id": 1,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/47.json"
}
]
}
]
}
Show Item
GET /api/v2/dynamic_content/items/{dynamic_content_item_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 |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/dynamic_content/items/47"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/dynamic_content/items/47")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/dynamic_content/items/47',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/dynamic_content/items/47"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/dynamic_content/items/47")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"item": {
"created_at": "2015-05-13T22:33:12Z",
"default_locale_id": 1,
"id": 47,
"name": "Snowboard Problem",
"outdated": false,
"placeholder": "{{dc.snowboard_problem}}",
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47.json",
"variants": [
{
"active": true,
"content": "Voici mon contenu dynamique en français",
"created_at": "2015-05-13T22:33:12Z",
"default": true,
"id": 47,
"locale_id": 16,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/47.json"
},
{
"active": true,
"content": "Este es mi contenido dinámico en español",
"created_at": "2015-05-13T22:33:12Z",
"default": false,
"id": 48,
"locale_id": 2,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/48.json"
}
]
}
}
Show Many Items
GET /api/v2/dynamic_content/items/show_many
Stability
- Development
Allowed For
- Admins, Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
identifiers | string | Query | false | Identifiers for the dynamic contents |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/show_many.json?identifiers=item_one,item_two
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/dynamic_content/items/show_many?identifiers=item1%2Citem2"
method := "GET"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/dynamic_content/items/show_many")
.newBuilder()
.addQueryParameter("identifiers", "item1,item2");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://example.zendesk.com/api/v2/dynamic_content/items/show_many',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'identifiers': 'item1%2Citem2',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/dynamic_content/items/show_many?identifiers=item1%2Citem2"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"GET",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/dynamic_content/items/show_many")
uri.query = URI.encode_www_form("identifiers": "item1,item2")
request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"items": [
{
"created_at": "2015-05-13T22:33:12Z",
"default_locale_id": 1,
"id": 47,
"name": "Snowboard Problem",
"outdated": true,
"placeholder": "{{dc.snowboard_problem}}",
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47.json",
"variants": [
{
"active": true,
"content": "C'est mon contenu dynamique en français",
"created_at": "2015-05-13T22:33:12Z",
"default": true,
"id": 47,
"locale_id": 1,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/47.json"
}
]
}
]
}
Create Item
POST /api/v2/dynamic_content/items
Create a new content item, with one or more variants in the item's variants
array. See Specifying item variants.
The default_locale_id
and variant locale_id
values must be one of the locales the account has active. You can get the list with the List Locales endpoint.
Allowed For
- Admins, Agents
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items.json \
-d '{"item": {"name": "Snowboard Problem", "default_locale_id": 16, "variants": [{"locale_id": 16, "default": true, "content": "Voici mon contenu dynamique en français"}, {"locale_id": 2, "default": false, "content": "Este es mi contenido dinámico en español"}]}}' \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/dynamic_content/items"
method := "POST"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/dynamic_content/items")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'POST',
url: 'https://example.zendesk.com/api/v2/dynamic_content/items',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/dynamic_content/items"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"POST",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/dynamic_content/items")
request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"item": {
"created_at": "2015-05-13T22:33:12Z",
"default_locale_id": 1,
"id": 47,
"name": "Snowboard Problem",
"outdated": false,
"placeholder": "{{dc.snowboard_problem}}",
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47.json",
"variants": [
{
"active": true,
"content": "Voici mon contenu dynamique en français",
"created_at": "2015-05-13T22:33:12Z",
"default": true,
"id": 47,
"locale_id": 16,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/47.json"
},
{
"active": true,
"content": "Este es mi contenido dinámico en español",
"created_at": "2015-05-13T22:33:12Z",
"default": false,
"id": 48,
"locale_id": 2,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/48.json"
}
]
}
}
Update Item
PUT /api/v2/dynamic_content/items/{dynamic_content_item_id}
The only attribute you can change is the name.
To add a variant to the item, or to update or delete the variants of the item, use the Item Variants API.
Allowed For
- Admins, Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
dynamic_content_item_id | integer | Path | true | The ID of the dynamic content item |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}.json \
-H "Content-Type: application/json" -d '{"item": {"name": "New name"}}'\
-v -u {email_address}/token:{api_token} -X PUT
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/dynamic_content/items/47"
method := "PUT"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/dynamic_content/items/47")
.newBuilder();
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
"""
""");
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'PUT',
url: 'https://example.zendesk.com/api/v2/dynamic_content/items/47',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/dynamic_content/items/47"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"PUT",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/dynamic_content/items/47")
request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"item": {
"created_at": "2015-05-13T22:33:12Z",
"default_locale_id": 1,
"id": 47,
"name": "New name",
"outdated": false,
"placeholder": "{{dc.snowboard_problem}}",
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47.json",
"variants": [
{
"active": true,
"content": "Voici mon contenu dynamique en français",
"created_at": "2015-05-13T22:33:12Z",
"default": true,
"id": 47,
"locale_id": 16,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/47.json"
},
{
"active": true,
"content": "Este es mi contenido dinámico en español",
"created_at": "2015-05-13T22:33:12Z",
"default": false,
"id": 48,
"locale_id": 2,
"outdated": false,
"updated_at": "2015-05-13T22:33:12Z",
"url": "https://company.zendesk.com/api/v2/dynamic_content/items/47/variants/48.json"
}
]
}
}
Delete Item
DELETE /api/v2/dynamic_content/items/{dynamic_content_item_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 |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/dynamic_content/items/{dynamic_content_item_id}.json \
-X DELETE -v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://example.zendesk.com/api/v2/dynamic_content/items/47"
method := "DELETE"
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
client := &http.Client {}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/dynamic_content/items/47")
.newBuilder();
String userCredentials = "your_email_address" + "/token:" + "your_api_token";
String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("DELETE", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", basicAuth)
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'DELETE',
url: 'https://example.zendesk.com/api/v2/dynamic_content/items/47',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/dynamic_content/items/47"
headers = {
"Content-Type": "application/json",
}
email_address = 'your_email_address'
api_token = 'your_api_token'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(
"DELETE",
url,
auth=auth,
headers=headers
)
print(response.text)
Ruby
require "net/http"
require "base64"
uri = URI("https://example.zendesk.com/api/v2/dynamic_content/items/47")
request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")
email = "your_email_address"
api_token = "your_api_token"
credentials = "#{email}/token:#{api_token}"
encoded_credentials = Base64.strict_encode64(credentials)
request["Authorization"] = "Basic #{encoded_credentials}"
response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
http.request(request)
end
Example response(s)
204 No Content
// Status 204 No Content
null