External Content Types
Use this API to define and manage external content types. A type refers to a kind of content, such as blog posts, tech notes, or bug reports. Because end users can filter help center search results by content type, use descriptive names to help them understand and navigate your content.
For more information on federated search, seeIntroductionandSetting up Zendesk Federated Search in your help centerin Zendesk help.
JSON format
Types are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | false | false | ISO-8601 compliant date-time reflecting the time the event was created. If not set, the API sets the value when it receives the event |
id | string | true | false | Universally Unique Lexicographically Sortable Identifier. Seehttps://github.com/ulid/spec |
name | string | false | true | The name of the type to be displayed in the help center |
updated_at | string | false | false | ISO-8601 compliant date-time reflecting the time the event was last updated |
List External Content Types
GET /api/v2/guide/external_content/types
Returns a list of the external content types created for this account.
Allowed For
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
page | object | 查询 | false | Paginate query |
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/guide/external_content/types\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/guide/external_content/types?page="
method:="GET"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/types")
.newBuilder()
.addQueryParameter("page","");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("GET",null)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'GET',
url:'https://support.zendesk.com/api/v2/guide/external_content/types',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
params:{
'page':'',
},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://support.zendesk.com/api/v2/guide/external_content/types?page="
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://support.zendesk.com/api/v2/guide/external_content/types")
uri.query=URI.encode_www_form("page":"")
request=Net::HTTP::Get.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"meta":{
"after_cursor":"MG",
"before_cursor":"MQ",
"has_more":true
},
"types":[
{
"created_at":"2020-05-01T09:12:20Z",
"id":"01EBDWWC98ZF7DK9YQF3DK9Y77",
"name":"Book",
"updated_at":"2020-05-26T09:11:30Z"
}
]
}
Show External Content Type
GET /api/v2/guide/external_content/types/{id}
Returns the specified content type.
Allowed For
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
id | string | Path | true | ULID for the object |
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/guide/external_content/types/{id}\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP"
method:="GET"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP")
.newBuilder();
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("GET",null)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'GET',
url:'https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP")
request=Net::HTTP::Get.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"type":{
"created_at":"2020-05-01T09:12:20Z",
"id":"01E7H2DC2EDTK45NZTFGFAAA1N",
"name":"Book",
"updated_at":"2020-05-26T09:11:30Z"
}
}
Create External Content Type
POST /api/v2/guide/external_content/types
Creates an external content type.
Allowed For
- Help Center managers
Example body
{
"type":{
"name":"Book"
}
}
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/guide/external_content/types\
-d'{"type": { "name": "Book" }}'\
-H"Content-Type: application/json"\
-v -u{email_address}:{password}-X POST
Go
import(
"fmt"
"io"
"net/http"
"strings"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/guide/external_content/types"
method:="POST"
payload:=strings.NewReader(`{
"type": {
"name": "Book"
}
}`)
req,err:=http.NewRequest(method,url,payload)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/types")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
{
\"type\":{
\"name\":\"Book\"
}
}""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("POST",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
vardata=JSON.stringify({
"type":{
"name":"Book"
}
});
varconfig={
method:'POST',
url:'https://support.zendesk.com/api/v2/guide/external_content/types',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
data:data,
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
importjson
url="https://support.zendesk.com/api/v2/guide/external_content/types"
payload=json.loads("""{
"type": {
"name": "Book"
}
}""")
headers={
"Content-Type":"application/json",
}
response=requests.request(
"POST",
url,
auth=('
' ,'' ),headers=headers,
json=payload
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://support.zendesk.com/api/v2/guide/external_content/types")
request=Net::HTTP::Post.new(uri,"Content-Type":"application/json")
request.body=%q({
"type":{
"name":"Book"
}
})
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
201 Created
// Status 201 Created
{
"type":{
"created_at":"2020-05-01T09:12:20Z",
"id":"01E7H2DC2EDTK45NZTFGFAAA1N",
"name":"Book",
"updated_at":"2020-05-26T09:11:30Z"
}
}
Update External Content Type
PUT /api/v2/guide/external_content/types/{id}
Updates the specified external content type with the request body.
Allowed For
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
id | string | Path | true | ULID for the object |
Example body
{
"type":{
"name":"Book"
}
}
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/guide/external_content/types/{id}\
-d'{"type": { "name": "Book" }}'\
-H"Content-Type: application/json"\
-v -u{email_address}:{password}-X PUT
Go
import(
"fmt"
"io"
"net/http"
"strings"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP"
method:="PUT"
payload:=strings.NewReader(`{
"type": {
"name": "Book"
}
}`)
req,err:=http.NewRequest(method,url,payload)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
{
\"type\":{
\"name\":\"Book\"
}
}""");
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("PUT",body)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
vardata=JSON.stringify({
"type":{
"name":"Book"
}
});
varconfig={
method:'PUT',
url:'https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
data:data,
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
importjson
url="https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP"
payload=json.loads("""{
"type": {
"name": "Book"
}
}""")
headers={
"Content-Type":"application/json",
}
response=requests.request(
"PUT",
url,
auth=('
' ,'' ),headers=headers,
json=payload
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP")
request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")
request.body=%q({
"type":{
"name":"Book"
}
})
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"type":{
"created_at":"2020-05-01T09:12:20Z",
"id":"01E7H2DC2EDTK45NZTFGFAAA1N",
"name":"Book",
"updated_at":"2020-05-26T09:11:30Z"
}
}
删除External Content Type
DELETE /api/v2/guide/external_content/types/{id}
删除s the specified external content type. Will also delete any crawler or record associated with this type.
Allowed For
- Help Center managers
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
id | string | Path | true | ULID for the object |
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/guide/external_content/types/{id}\
-v -u{email_address}:{password}-X DELETE
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP"
method:="DELETE"
req,err:=http.NewRequest(method,url,nil)
iferr!=nil{
fmt.Println(err)
return
}
req.Header.Add("Content-Type","application/json")
req.Header.Add("Authorization","Basic
" )// Base64 encoded "username:password"client:=&http.Client{}
res,err:=client.Do(req)
iferr!=nil{
fmt.Println(err)
return
}
deferres.Body.Close()
body,err:=io.ReadAll(res.Body)
iferr!=nil{
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
importcom.squareup.okhttp.*;
OkHttpClientclient=newOkHttpClient();
HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP")
.newBuilder();
Requestrequest=newRequest.Builder()
.url(urlBuilder.build())
.method("DELETE",null)
.addHeader("Content-Type","application/json")
.addHeader("Authorization",Credentials.basic("your-email","your-password"))
.build();
Responseresponse=client.newCall(request).execute();
Nodejs
varaxios=require('axios');
varconfig={
method:'DELETE',
url:'https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP',
headers:{
'Content-Type':'application/json',
'Authorization':'Basic
' ,// Base64 encoded "username:password"},
};
axios(config)
.then(function(response){
console.log(JSON.stringify(response.data));
})
.catch(function(error){
console.log(error);
});
Python
importrequests
url="https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"DELETE",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://support.zendesk.com/api/v2/guide/external_content/types/01E7GZVZHBWYD50V00XDMYCMYP")
request=Net::HTTP::删除.new(uri,"Content-Type":"application/json")
request.basic_auth"username","password"
response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|
http.request(request)
end
Example response(s)
204 No Content
// Status 204 No Content
null