Locales
Zendesk Support can be viewed in a number of supported languages. The Locales API retrieves locale information in Support or a Zendesk account.
JSON format
Locales are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
created_at | string | true | false | The ISO 8601 formatted date-time the locale was created |
id | integer | true | false | 地区的惟一ID |
locale | string | true | false | The name of the locale |
name | string | true | false | The name of the language |
updated_at | string | true | false | The ISO 8601 formatted date-time when the locale was last updated |
url | string | true | false | The URL of the locale record |
Example
{
"created_at":"2009-07-20T22:55:29Z",
"id":1,
"locale":"en-US",
"name":"English",
"updated_at":"2011-05-05T10:38:52Z",
"url":"https://company.zendesk.com/api/v2/locales/en-US.json"
}
List Locales
GET /api/v2/locales
Lists the translation locales available for the account.
Note: You can alter the list by passing an updatedlocale_ids
array to theUpdate Account Settingsendpoint.
Allowed For
- Anyone
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/locales.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/locales"
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://example.zendesk.com/api/v2/locales")
.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://example.zendesk.com/api/v2/locales',
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://example.zendesk.com/api/v2/locales"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/locales")
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
{
"locales":[
{
"created_at":"2009-07-20T22:55:29Z",
"id":1,
"locale":"en-US",
"name":"English",
"updated_at":"2011-05-05T10:38:52Z",
"url":"https://company.zendesk.com/api/v2/locales/en-US.json"
},
{
"created_at":"2010-12-23T12:45:22Z",
"id":8,
"locale":"de",
"name":"Deutsch",
"updated_at":"2012-04-01T10:44:12Z",
"url":"https://company.zendesk.com/api/v2/locales/de.json"
}
]
}
List Locales for Agent
GET /api/v2/locales/agent
Lists the translation locales that have been localized for agents on a specific account.
Allowed For
- Anyone
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/locales/agent.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/locales/agent"
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://example.zendesk.com/api/v2/locales/agent")
.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://example.zendesk.com/api/v2/locales/agent',
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://example.zendesk.com/api/v2/locales/agent"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/locales/agent")
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
{
"locales":[
{
"created_at":"2009-07-20T22:55:29Z",
"id":1,
"locale":"en-US",
"name":"English",
"updated_at":"2011-05-05T10:38:52Z",
"url":"https://company.zendesk.com/api/v2/locales/en-US.json"
},
{
"created_at":"2010-12-23T12:45:22Z",
"id":8,
"locale":"de",
"name":"Deutsch",
"updated_at":"2012-04-01T10:44:12Z",
"url":"https://company.zendesk.com/api/v2/locales/de.json"
}
]
}
List Available Public Locales
GET /api/v2/locales/public
Lists the translation locales that are available to all accounts.
Allowed For
- Anyone
Code Samples
旋度
旋度https://{subdomain}.亚博zendesk.com/api/v2/locales/public.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/locales/public"
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://example.zendesk.com/api/v2/locales/public")
.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://example.zendesk.com/api/v2/locales/public',
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://example.zendesk.com/api/v2/locales/public"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/locales/public")
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
{
"locales":[
{
"created_at":"2009-07-20T22:55:29Z",
"id":1,
"locale":"en-US",
"name":"English",
"updated_at":"2011-05-05T10:38:52Z",
"url":"https://company.zendesk.com/api/v2/locales/en-US.json"
},
{
"created_at":"2010-12-23T12:45:22Z",
"id":8,
"locale":"de",
"name":"Deutsch",
"updated_at":"2012-04-01T10:44:12Z",
"url":"https://company.zendesk.com/api/v2/locales/de.json"
}
]
}
Show Current Locale
GET /api/v2/locales/current
This works likeShow Locale, but instead of taking a locale id as an argument, it renders the locale of the user performing the request.
Allowed For
- Anyone
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/locales/current.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/locales/current"
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://example.zendesk.com/api/v2/locales/current")
.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://example.zendesk.com/api/v2/locales/current',
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://example.zendesk.com/api/v2/locales/current"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/locales/current")
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
{
"locale":{
"created_at":"2010-12-23T12:45:22Z",
"id":8,
"locale":"de",
"name":"Deutsch",
"updated_at":"2012-04-01T10:44:12Z",
"url":"https://company.zendesk.com/api/v2/locales/de.json"
}
}
Show Locale
GET /api/v2/locales/{locale_id}
Allowed For
- Anyone
Parameters
Name | Type | In | 要求 | Description |
---|---|---|---|---|
locale_id | string | Path | true | The ID or theBCP-47 codeof the locale. Examples: es-419, en-us, pr-br |
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/locales/{locale_id}.json\
-v -u{email_address}:{password}
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/locales/es-419"
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://example.zendesk.com/api/v2/locales/es-419")
.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://example.zendesk.com/api/v2/locales/es-419',
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://example.zendesk.com/api/v2/locales/es-419"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/locales/es-419")
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
{
"locale":{
"created_at":"2010-12-23T12:45:22Z",
"id":8,
"locale":"de",
"name":"Deutsch",
"updated_at":"2012-04-01T10:44:12Z",
"url":"https://company.zendesk.com/api/v2/locales/de.json"
}
}
Detect Best Language for User
GET /api/v2/locales/detect_best_locale
Allowed For
- Anyone
Code Samples
旋度
旋度https://{subdomain}.zendesk.com/api/v2/locales/detect_best_locale\
-v -u{email_address}:{password}\
-H"Content-Type: application/json"-X PUT\
-d'{"available_locales":["es", "ja", "en-uk"]}'
Go
import(
"fmt"
"io"
"net/http"
)
funcmain(){
url:="https://example.zendesk.com/api/v2/locales/detect_best_locale"
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://example.zendesk.com/api/v2/locales/detect_best_locale")
.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://example.zendesk.com/api/v2/locales/detect_best_locale',
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://example.zendesk.com/api/v2/locales/detect_best_locale"
headers={
"Content-Type":"application/json",
}
response=requests.request(
"GET",
url,
auth=('
' ,'' ),headers=headers
)
print(response.text)
Ruby
require"net/http"
uri=URI("https://example.zendesk.com/api/v2/locales/detect_best_locale")
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
{
"locale":{
"created_at":"2010-12-23T12:45:22Z",
"id":1,
"locale":"en",
"name":"English",
"updated_at":"2012-04-01T10:44:12Z",
"url":"https://company.zendesk.com/api/v2/locales/en-US.json"
}
}