App Locations
For more information on locations, see Setting the app location in the Apps developer docs.
JSON format
App Locations are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
collapsible | boolean | true | false | The value is true if reordering has any effect |
host_application | string | true | false | The unique host application key |
id | integer | true | false | Internal location ID |
name | string | true | false | The unique location key |
orderable | boolean | true | false | The value is true if reordering has any effect |
product_code | integer | true | false | Internal product ID |
visible | boolean | true | false | The value is true if users can see and access location |
Example
{
"collapsible": true,
"host_application": "zendesk",
"id": 1,
"name": "top_bar",
"orderable": true,
"product_code": 1,
"visible": true
}
List Locations
GET /api/v2/apps/locations
Returns a list of available locations for Zendesk apps.
Allowed For
- Admins
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/apps/locations.json \
-u {email_address}:{password}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/apps/locations"
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 "username:password"
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://support.zendesk.com/api/v2/apps/locations")
.newBuilder();
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("your-email", "your-password"))
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/apps/locations',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
url = "https://support.zendesk.com/api/v2/apps/locations"
headers = {
"Content-Type": "application/json",
}
response = requests.request(
"GET",
url,
auth=('<username>', '<password>'),
headers=headers
)
print(response.text)
Ruby
require "net/http"
uri = URI("https://support.zendesk.com/api/v2/apps/locations")
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: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"locations": [
{
"host_application": "zendesk",
"id": 1,
"name": "top_bar",
"orderable": true
},
{
"host_application": "zendesk",
"id": 2,
"name": "nav_bar",
"orderable": true
},
{
"host_application": "zendesk",
"id": 3,
"name": "ticket_sidebar",
"orderable": true
},
{
"host_application": "zendesk",
"id": 4,
"name": "new_ticket_sidebar",
"orderable": true
},
{
"host_application": "zendesk",
"id": 5,
"name": "user_sidebar",
"orderable": true
}
]
}
Show Location
GET /api/v2/apps/locations/{app_location_id}
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
app_location_id | integer | Path | true | The ID of the app location |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/apps/locations/{app_location_id}.json \
-u {email_address}:{password}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/apps/locations/1"
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 "username:password"
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://support.zendesk.com/api/v2/apps/locations/1")
.newBuilder();
Request request = new Request.Builder()
.url(urlBuilder.build())
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", Credentials.basic("your-email", "your-password"))
.build();
Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/apps/locations/1',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "username:password"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
url = "https://support.zendesk.com/api/v2/apps/locations/1"
headers = {
"Content-Type": "application/json",
}
response = requests.request(
"GET",
url,
auth=('<username>', '<password>'),
headers=headers
)
print(response.text)
Ruby
require "net/http"
uri = URI("https://support.zendesk.com/api/v2/apps/locations/1")
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: true do |http|
http.request(request)
end
Example response(s)
200 OK
// Status 200 OK
{
"location": {
"host_application": "zendesk",
"id": 1,
"name": "top_bar"
}
}