Article Labels
Article labels are only available on the Professional and Enterprise plans.
JSON format
Article Labels are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | true | false | The time at which the label was created |
id | integer | true | false | Automatically assigned when the label is created |
name | string | false | true | The actual name of the label |
updated_at | string | true | false | The time at which the label was last updated |
url | string | true | false | The API url of this label |
Example
{
"created_at":"2012-04-04T09:14:57Z",
"id":2003,
"name":"instructions"
}
List All Labels
GET /api/v2/help_center/articles/labels
列表中的所有标签的文章帮助Center.
Allowed for
- Agents
Code Samples
curl
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/articles/labels.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/help_center/articles/labels"
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/help_center/articles/labels")
.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/help_center/articles/labels',
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/help_center/articles/labels"
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/help_center/articles/labels")
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
{
"labels":[
{
"created_at":"2012-04-04T09:14:57Z",
"id":2003,
"name":"instructions",
"updated_at":"2012-04-04T09:14:57Z",
"url":"https://{subdomain}.zendesk.com/api/v2/help_center/articles/labels/42.json"
}
]
}
List Article Labels
GET /api/v2/help_center{/locale}/articles/{article_id}/labels
Lists all the labels in a given article.
Allowed for
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
locale | string | Path | false | The locale the item is displayed in |
Code Samples
curl
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/labels.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/help_center{/locale}/articles/360026053753/labels"
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/help_center{/locale}/articles/360026053753/labels")
.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/help_center{/locale}/articles/360026053753/labels',
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/help_center{/locale}/articles/360026053753/labels"
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/help_center{/locale}/articles/360026053753/labels")
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
{
"labels":[
{
"created_at":"2012-04-04T09:14:57Z",
"id":2003,
"name":"instructions",
"updated_at":"2012-04-04T09:14:57Z",
"url":"https://{subdomain}.zendesk.com/api/v2/help_center/articles/labels/42.json"
}
]
}
Show Label
GET /api/v2/help_center/articles/labels/{label_id}
Shows the properties of the specified label.
Allowed for
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
label_id | integer | Path | true | The unique ID of the label |
Code Samples
curl
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/labels/{label_id}.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/help_center/articles/labels/360015727233"
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/help_center/articles/labels/360015727233")
.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/help_center/articles/labels/360015727233',
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/help_center/articles/labels/360015727233"
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/help_center/articles/labels/360015727233")
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
{
"label":{
"created_at":"2012-04-04T09:14:57Z",
"id":2003,
"name":"instructions",
"updated_at":"2012-04-04T09:14:57Z",
"url":"https://{subdomain}.zendesk.com/api/v2/help_center/en-us/articles/labels/42.json"
}
}
Create Label
POST /api/v2/help_center{/locale}/articles/{article_id}/labels
Allowed for
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
locale | string | Path | false | The locale the item is displayed in |
Code Samples
curl
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/labels.json\
-d'{"label": {"name": "instructions"}}'\
-v -u{email_address}:{password}-X POST -H"Content-Type: application/json"
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/help_center{/locale}/articles/360026053753/labels"
method:="POST"
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/help_center{/locale}/articles/360026053753/labels")
.newBuilder();
RequestBodybody=RequestBody.create(MediaType.parse("application/json"),
"""
""");
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');
varconfig={
method:'POST',
url:'https://support.zendesk.com/api/v2/help_center{/locale}/articles/360026053753/labels',
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/help_center{/locale}/articles/360026053753/labels"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"POST",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://support.zendesk.com/api/v2/help_center{/locale}/articles/360026053753/labels")
request=Net::HTTP::Post.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)
201 Created
// Status 201 Created
{
"label":{
"created_at":"2012-04-04T09:14:57Z",
"id":2003,
"name":"instructions",
"updated_at":"2012-04-04T09:14:57Z",
"url":"https://{subdomain}.zendesk.com/api/v2/help_center/en-us/articles/labels/42.json"
}
}
Delete Label
DELETE /api/v2/help_center/articles/labels/{label_id}
Removes the label from all articles and deletes it.
Allowed for
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
label_id | integer | Path | true | The unique ID of the label |
Code Samples
curl
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/articles/labels/{label_id}.json\
-v -u{email_address}:{password}-X DELETE
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/help_center/articles/labels/360015727233"
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/help_center/articles/labels/360015727233")
.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/help_center/articles/labels/360015727233',
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/help_center/articles/labels/360015727233"
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/help_center/articles/labels/360015727233")
request=Net::HTTP::Delete.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
Delete Label from Article
DELETE /api/v2/help_center{/locale}/articles/{article_id}/labels/{label_id}
Removes the label from the specified article's list of labels.
Allowed for
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
article_id | integer | Path | true | The unique ID of the article |
label_id | integer | Path | true | The unique ID of the label |
locale | string | Path | false | The locale the item is displayed in |
Code Samples
curl
curlhttps://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/labels/{label_id}.json\
-v -u{email_address}:{password}-X DELETE
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://support.zendesk.com/api/v2/help_center{/locale}/articles/360026053753/labels/360015727233"
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/help_center{/locale}/articles/360026053753/labels/360015727233")
.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/help_center{/locale}/articles/360026053753/labels/360015727233',
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/help_center{/locale}/articles/360026053753/labels/360015727233"
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/help_center{/locale}/articles/360026053753/labels/360015727233")
request=Net::HTTP::Delete.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