### App Installation Requirements (GET) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This example shows how to list app requirements for a specific installation using a GET request. The `app_installation_id` is a required path parameter. ```API GET /api/v2/apps/installations/{app_installation_id}/requirements ``` -------------------------------- ### Example App Installation Response Source: https://developer.zendesk.com/api-reference/sales-crm/apps/apps This is an example of a successful response when retrieving app installations. It includes details about the installed app, its settings, and subscription information. ```json Status 200 OK { "installations": [ { "app_id": 218618, "collapsible": true, "created_at": "2020-06-11T06:12:48Z", "enabled": true, "group_restrictions": [], "has_incomplete_subscription": false, "has_unpaid_subscription": null, "id": 361234573552, "paid": null, "pending_installation": true, "pending_job_id": "587986abda901cde3873697585091dab", "plan_information": { "name": null }, "product": "sell", "recurring_payment": false, "redirect_path": "/sell/apps/manage", "role_restrictions": null, "servable": true, "settings": { "attachment_tag": "has_attachment", "blocklist": null, "items_per_page": "6", "name": "Attachment Manager", "new_attachment_tag": "has_new_attachment", "title": "Attachment Manager", "allowlist": null }, "settings_objects": [ { "name": "attachment_tag", "value": "has_attachment" }, { "name": "blocklist", "value": null }, { "name": "items_per_page", "value": "6" }, { "name": "name", "value": "Attachment Manager" }, { "name": "new_attachment_tag", "value": "has_new_attachment" }, { "name": "title", "value": "Attachment Manager" }, { "name": "allowlist", "value": null } ], "stripe_account": "acct_1CyabcGO5FKrIYc5", "stripe_subscription_id": null, "stripe_publishable_key": "pk_live_zMw5abcdYBbd6axDbyrzrRl9", "updated": "20200305221223", "updated_at": "2020-06-11T06:12:48Z" } ] } ``` -------------------------------- ### Show App Installation (Node.js) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This Node.js example uses the axios library to make a GET request to fetch app installation details. It configures the request with the correct URL, headers, and method. The Authorization header should contain your Base64 encoded credentials. ```javascript var axios = require('axios'); var config = { method: 'GET', url: 'https://support.zendesk.com/api/v2/apps/installations/1', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ', // Base64 encoded "{email_address}/token:{api_token}" }, }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### Get App Installation Requirements (Ruby) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps Fetch app installation requirements in Ruby using the Net::HTTP library. This example shows how to encode credentials for basic authentication and make the GET request. ```Ruby require "net/http" require "base64" uri = URI("https://support.zendesk.com/api/v2/apps/installations/1/requirements") 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 for 200 OK Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This is an example of a successful response (200 OK) when retrieving app installation requirements. It lists the requirements associated with an app installation. ```json // Status 200 OK { "requirements": [ { "account_id": 2, "created_at": "2014-03-26T00:57:43Z", "identifier": "a_basecamp_target", "requirement_id": 302, "requirement_type": "targets", "updated_at": "2014-03-26T00:57:43Z" }, { "account_id": 2, "created_at": "2014-03-26T00:57:43Z", "identifier": "an_email_target", "requirement_id": 307, "requirement_type": "targets", "updated_at": "2014-03-26T00:57:43Z" }, { "account_id": 2, "created_at": "2014-03-26T00:57:43Z", "identifier": "sample_ticket_field", "requirement_id": 137, "requirement_type": "ticket_fields", "updated_at": "2014-03-26T00:57:43Z" } ] } ``` -------------------------------- ### Example App Installation Response Source: https://developer.zendesk.com/api-reference/sales-crm/apps/apps Illustrates the structure of a successful response when fetching an app installation. Includes details like agent count, app ID, installation date, and settings. ```json { "installation": { "agent_count": 0, "app_id": 218618, "app_installation_count": null, "author_email": "john.doe@example.com", "email": "john.doe@example.com", "framework_versions": { "current": "2.0", "version": "2.0" }, "group_restrictions": [], "has_custom_object_requirements": false, "has_incomplete_subscription": false, "has_oauth_client": false, "has_unpaid_subscription": null, "id": 361234573552, "installed_at": "2023-01-05T15:25:16Z", "locale": "en-US-x-1", "locations": [ { "name": "deal_card", "visible": true } ], "marketing_only": false, "new_installation": false, "obsolete": false, "paid": null, "plan_id": null, "require_category_terms": false, "require_oauth_subdomain": false, "role_restrictions": [], "settings": [ { "attachment_tag": "has_attachment", "blocklist": null, "items_per_page": "6", "name": "Attachment Manager", "new_attachment_tag": "has_new_attachment", "title": "Attachment Manager", "allowlist": null } ], "supports_group_restrictions": false, "supports_role_restrictions": false, "third_party_paid": false, "version": "1.0.0", "zendesk_labs_license_url": null } } ``` -------------------------------- ### App Installation Response (200 OK) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This is an example of a successful response when installing an app. It includes details about the installed app, its settings, and status. ```json // Status 200 OK { "app_id": 218618, "collapsible": true, "created_at": "2020-06-11T06:12:48Z", "enabled": true, "group_restrictions": [], "has_incomplete_subscription": false, "has_unpaid_subscription": null, "id": 361234573552, "paid": null, "pending_installation": true, "pending_job_id": "587986abda901cde3873697585091dab", "plan_information": { "name": null }, "product": "support", "recurring_payment": false, "redirect_path": "/support/apps/manage", "role_restrictions": null, "servable": true, "settings": { "allowlist": null, "attachment_tag": "has_attachment", "blocklist": null, "items_per_page": "6", "name": "Attachment Manager", "new_attachment_tag": "has_new_attachment", "title": "Attachment Manager" }, "settings_objects": [ { "name": "attachment_tag", "value": "has_attachment" }, { "name": "blocklist", "value": null }, { "name": "items_per_page", "value": "6" }, { "name": "name", "value": "Attachment Manager" }, { "name": "new_attachment_tag", "value": "has_new_attachment" }, { "name": "title", "value": "Attachment Manager" }, { "name": "allowlist", "value": null } ], "stripe_account": "acct_1CyabcGO5FKrIYc5", "stripe_publishable_key": "pk_live_zMw5abcdYBbd6axDbyrzrRl9", "stripe_subscription_id": null, "updated": "20200305221223", "updated_at": "2020-06-11T06:12:48Z" } ``` -------------------------------- ### Example Guide Media HTML Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias An example of how a guide media URL can be used within HTML to display an image in a help center article. ```html

Hello World

guide-media

``` -------------------------------- ### Example Response for Reordering App Installations Source: https://developer.zendesk.com/api-reference/ticketing/apps/app_location_installations This is an example of a successful response (Status 201 Created) when reordering app installations. ```json // Status 201 Created { "location_installation": { "installations": [ 82, 56 ], "location_name": "nav_bar" } } ``` -------------------------------- ### Get App Installations in Java Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps Use the OkHttpClient to make a GET request for app installations. Construct the Authorization header with your base64 encoded credentials. ```Java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/apps/installations") .newBuilder(); String userCredentials = "your_email_address" + ":" + "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(); ``` -------------------------------- ### Example Response for List Location Installations Source: https://developer.zendesk.com/api-reference/ticketing/apps/app_location_installations This is an example of a successful (200 OK) response when listing app location installations. It shows the structure of the returned data, including installations and their associated location names. ```json // Status 200 OK { "location_installations": [ { "installations": [ 82, 56 ], "location_name": "nav_bar" }, { "installations": [ 111, 82, 87, 56, 46, 96, 77 ], "location_name": "ticket_sidebar" }, { "installations": [ 111, 82, 56 ], "location_name": "new_ticket_sidebar" }, { "installations": [ 106, 91 ], "location_name": "top_bar" } ] } ``` -------------------------------- ### App Installation Response Source: https://developer.zendesk.com/api-reference/sales-crm/apps/apps Example of a successful app installation response, indicating a 201 Created status and details of the installed app. ```json { "app_id": 218618, "collapsible": true, "created_at": "2020-06-11T06:12:48Z", "enabled": true, "group_restrictions": [], "has_incomplete_subscription": false, "has_unpaid_subscription": null, "id": 361234573552, "paid": null, "pending_installation": true, "pending_job_id": "587986abda901cde3873697585091dab", "plan_information": { "name": null }, "product": "sell", "recurring_payment": false, "redirect_path": "/sell/apps/manage", "role_restrictions": null, "servable": true, "settings": { "attachment_tag": "has_attachment", "blocklist": null, "items_per_page": "6", "name": "Attachment Manager", "new_attachment_tag": "has_new_attachment", "title": "Attachment Manager", "allowlist": null }, "settings_objects": [ { "name": "attachment_tag", "value": "has_attachment" }, { "name": "blocklist", "value": null }, { "name": "items_per_page", "value": "6" }, { "name": "name", "value": "Attachment Manager" }, { "name": "new_attachment_tag", "value": "has_new_attachment" }, { "name": "title", "value": "Attachment Manager" }, { "name": "allowlist", "value": null } ], "stripe_account": "acct_1CyabcGO5FKrIYc5", "stripe_subscription_id": null, "stripe_publishable_key": "pk_live_zMw5abcdYBbd6axDbyrzrRl9", "updated": "20200305221223", "updated_at": "2020-06-11T06:12:48Z" } ``` -------------------------------- ### Install App via Java Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps Example of installing a Zendesk app using Java with OkHttp. It shows how to construct the request with JSON body and basic authentication. ```java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/apps/installations") .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(); ``` -------------------------------- ### Show App Installation (Java) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This Java snippet uses the OkHttp client to retrieve app installation information. It constructs the URL, sets the necessary headers including Basic Authentication, and executes the request. Remember to replace placeholder credentials. ```java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/apps/installations/1") .newBuilder(); String userCredentials = "your_email_address" + ":" + "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(); ``` -------------------------------- ### Get App Installation Requirements (Node.js) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps Use this Node.js example with the axios library to get app installation requirements. The Authorization header should contain your Base64 encoded credentials. ```Node.js var axios = require('axios'); var config = { method: 'GET', url: 'https://support.zendesk.com/api/v2/apps/installations/1/requirements', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ', // Base64 encoded "{email_address}/token:{api_token}" }, }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### Get Target using Node.js Source: https://developer.zendesk.com/api-reference/ticketing/targets/targets This Node.js example uses the Axios library to make a GET request to the Zendesk API for a specific target. Ensure Axios is installed (`npm install axios`). ```javascript var axios = require('axios'); var config = { method: 'GET', url: 'https://example.zendesk.com/api/v2/targets/211', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ', // Base64 encoded "{email_address}/token:{api_token}" }, }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### Show App Installation (Go) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This Go code snippet demonstrates how to fetch app installation details using the Zendesk API. Ensure you have the necessary HTTP client and error handling in place. The Authorization header should be a Base64 encoded string of your email address and API token. ```go import ( "fmt" "io" "net/http" ) func main() { url := "https://support.zendesk.com/api/v2/apps/installations/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 ") // 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)) } ``` -------------------------------- ### Start OAuth Redirect Go Request Source: https://developer.zendesk.com/api-reference/integration-services/connections/oauth_connections Example Go code to make an HTTP GET request to start the OAuth redirect flow. ```go import ( "fmt" "io" "net/http" ) func main() { url := "https://support.zendesk.com/api/services/zis/connections/oauth/start_redirect?flow_token=TgtEfGWfduqzwNnkST8jNsr5MnjPnYEt" method := "GET" req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") 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))} ``` -------------------------------- ### Upload Guide Media with Java Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias This Java snippet shows how to upload media using the Zendesk Guide API with OkHttp. It includes setting up the client, request, and authentication. ```Java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://your_account_subdomain.zendesk.com/api/v2/api/v2/guide/medias") .newBuilder(); RequestBody body = RequestBody.create(MediaType.parse("application/json"), """ { "asset_upload_id": "01J2BS9DMQFEAVJZNBEJNDS3TZ", "filename": "Screenshot 2024-07-04 at 10.39.26.png" } """ ); 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(); ``` -------------------------------- ### Get Inline Article Attachment (Python) Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/article_attachments This Python example uses the requests library to get an inline article attachment. It demonstrates basic authentication setup. ```Python import requests from requests.auth import HTTPBasicAuth url = "https://support.zendesk.com/api/v2/help_center/articles/360026053753/attachments/inline" 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) ``` -------------------------------- ### Create a Help Center article using Go Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/articles This Go program demonstrates how to create a Help Center article using the HTTP client. It constructs the request with the necessary headers and payload. Replace `` with your Base64 encoded credentials. ```go import ( "fmt" "io" "net/http" "strings" ) func main() { url := "https://support.zendesk.com/api/v2/help_center/en-us/sections/360004785313/articles" method := "POST" payload := strings.NewReader(`{ "article": { "body": "Use a tripod", "locale": "en-us", "permission_group_id": 56, "title": "Taking photos in low light", "user_segment_id": 123 }, "notify_subscribers": false }`) req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Basic ") // 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))} ``` -------------------------------- ### Example Response for Get Holiday Source: https://developer.zendesk.com/api-reference/ticketing/ticket-management/schedules This is an example of a successful (200 OK) response when retrieving holiday details. It includes the holiday's ID, name, start date, and end date. ```json // Status 200 OK { "holiday": { "end_date": "2021-01-02", "id": 1, "name": "New Year", "start_date": "2020-12-30" } } ``` -------------------------------- ### Start OAuth Redirect Node.js Request Source: https://developer.zendesk.com/api-reference/integration-services/connections/oauth_connections Example Node.js code using axios to make an HTTP GET request for the OAuth redirect. ```javascript var axios = require('axios'); var config = { method: 'GET', url: 'https://support.zendesk.com/api/services/zis/connections/oauth/start_redirect', headers: { 'Content-Type': 'application/json', }, params: { 'flow_token': 'TgtEfGWfduqzwNnkST8jNsr5MnjPnYEt', }, }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### Fetch Guide Media with Go Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias This Go program demonstrates how to make a GET request to the Guide Media API. Ensure you replace placeholders and correctly format your authorization header. ```go import ( "fmt" "io" "net/http" ) func main() { url := "https://your_account_subdomain.zendesk.com/api/v2/api/v2/guide/medias?filter=&page=&sort=" 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 ") // 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))} ``` -------------------------------- ### Start OAuth Redirect Java Request Source: https://developer.zendesk.com/api-reference/integration-services/connections/oauth_connections Example Java code using OkHttp to make an HTTP GET request for the OAuth redirect. ```java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/services/zis/connections/oauth/start_redirect") .newBuilder() .addQueryParameter("flow_token", "TgtEfGWfduqzwNnkST8jNsr5MnjPnYEt"); Request request = new Request.Builder() .url(urlBuilder.build()) .method("GET", null) .addHeader("Content-Type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Create Article using Go Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/articles Use Go's net/http package to create a Help Center article. Ensure you replace placeholder authentication values. ```go import ( "fmt" "io" "net/http" "strings" ) func main() { url := "https://support.zendesk.com/api/v2/help_center/sections/360004785313/articles" method := "POST" payload := strings.NewReader(`{ "article": { "body": "Use a tripod", "locale": "en-us", "permission_group_id": 56, "title": "Taking photos in low light", "user_segment_id": 123 }, "notify_subscribers": false }`) req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Basic ") // 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)) } ``` -------------------------------- ### Get User Events (Python) Source: https://developer.zendesk.com/api-reference/ticketing/users/events-api/events-api This Python example uses the requests library to fetch user events. It demonstrates basic authentication setup. ```Python import requests from requests.auth import HTTPBasicAuth url = "https://support.zendesk.com/api/v2/users/120077332/events?filter[end_time]=&filter[source]=&filter[start_time]=&filter[type]=&page[size]=" 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) ``` -------------------------------- ### Get Goal by ID (Go) Source: https://developer.zendesk.com/api-reference/live-chat/chat-api/goals Example using Go to retrieve a specific goal by its ID. Ensure you have the necessary HTTP client setup. ```go import ( "fmt" "io" "net/http" ) func main() { url := "https://subdomain.zendesk.com/api/v2/chat/goals/1" method := "GET" req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") 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)) ``` -------------------------------- ### Upload Guide Media with Go Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias This Go snippet demonstrates how to upload a media asset using the Zendesk Guide API. Ensure you have the necessary HTTP client and request setup. ```Go import ( "fmt" "io" "net/http" "strings" ) func main() { url := "https://your_account_subdomain.zendesk.com/api/v2/api/v2/guide/medias" method := "POST" payload := strings.NewReader(`{ "asset_upload_id": "01J2BS9DMQFEAVJZNBEJNDS3TZ", "filename": "Screenshot 2024-07-04 at 10.39.26.png" }`) req, err := http.NewRequest(method, url, payload) if err != nil { fmt.Println(err) return } req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Basic ") // 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)) } ``` -------------------------------- ### Start OAuth Redirect Ruby Request Source: https://developer.zendesk.com/api-reference/integration-services/connections/oauth_connections Example Ruby code using Net::HTTP to make an HTTP GET request for the OAuth redirect. ```ruby require "net/http" uri = URI("https://support.zendesk.com/api/services/zis/connections/oauth/start_redirect") uri.query = URI.encode_www_form("flow_token": "TgtEfGWfduqzwNnkST8jNsr5MnjPnYEt") request = Net::HTTP::Get.new(uri, "Content-Type": "application/json") response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http| http.request(request) end ``` -------------------------------- ### Create Bookmark with Java Source: https://developer.zendesk.com/api-reference/ticketing/ticket-management/bookmarks Example of creating a bookmark using Java with OkHttp. It shows how to construct the request, set headers including basic authentication, and execute the call. ```java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/bookmarks") .newBuilder(); RequestBody body = RequestBody.create(MediaType.parse("application/json"), """ { "bookmark": { "ticket_id": 113 } } """); 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(); ``` -------------------------------- ### Start OAuth Redirect Python Request Source: https://developer.zendesk.com/api-reference/integration-services/connections/oauth_connections Example Python code using the requests library to make an HTTP GET request for the OAuth redirect. ```python import requests url = "https://support.zendesk.com/api/services/zis/connections/oauth/start_redirect?flow_token=TgtEfGWfduqzwNnkST8jNsr5MnjPnYEt" headers = { "Content-Type": "application/json", } response = requests.request( "GET", url, headers=headers ) print(response.text) ``` -------------------------------- ### Get Brand Agent (Python) Source: https://developer.zendesk.com/api-reference/ticketing/account-configuration/brand_agents Fetch brand agent details in Python using the requests library. This example demonstrates basic authentication setup. ```Python import requests from requests.auth import HTTPBasicAuth url = "https://example.zendesk.com/api/v2/users/35436/brand_agents/123ABC" 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) ``` -------------------------------- ### Example API Response: 200 OK Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias This is an example of a successful response (200 OK) when fetching guide media. It includes metadata and a list of media records. ```json // Status 200 OK { "meta": { "after_cursor": "MW", "before_cursor": "MQ", "has_more": true }, "records": [ { "access_key": "01E86XPM9459S78F83VH8CD69H", "content_type": "image/png", "created_at": "2020-05-13T11:46:19.000Z", "id": "01E86XPPRDCNHYTSVWSRMD76R0", "name": "hero.png", "size": 10394, "updated_at": "2020-05-13T11:46:19.000Z", "url": "/guide-media/01E86XPM9459S78F83VH8CD69H", "version": 5 } ] } ``` -------------------------------- ### Get Group Details (Java) Source: https://developer.zendesk.com/api-reference/ticketing/groups/groups Fetch group details using Java. This example uses OkHttp and requires proper setup of the OkHttpClient and authentication headers. ```Java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/groups/122") .newBuilder() .addQueryParameter("include", "users,group_settings"); 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(); ``` -------------------------------- ### Create Article using Java Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/articles Use OkHttp client in Java to create a Help Center article. Remember to replace placeholder authentication credentials. ```java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/help_center/sections/360004785313/articles") .newBuilder(); RequestBody body = RequestBody.create(MediaType.parse("application/json"), """ { "article": { "body": "Use a tripod", "locale": "en-us", "permission_group_id": 56, "title": "Taking photos in low light", "user_segment_id": 123 }, "notify_subscribers": false } """ ); 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(); ``` -------------------------------- ### Get Account Overview Stats (Node.js) Source: https://developer.zendesk.com/api-reference/voice/talk-api/stats This Node.js example uses Axios to fetch account overview statistics. Ensure you have Axios installed and replace the placeholder authentication value. ```javascript var axios = require('axios'); var config = { method: 'GET', url: 'https://support.zendesk.com/api/v2/channels/voice/stats/account_overview', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ', // Base64 encoded "{email_address}/token:{api_token}" }, params: { 'phone_number_ids': '', }, }; axios(config).then(function (response) { console.log(JSON.stringify(response.data)); }).catch(function (error) { console.log(error); }); ``` -------------------------------- ### Fetch Guide Media with Java Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/guide_medias This Java code snippet shows how to query the Guide Media API using OkHttp. It constructs the URL with query parameters and sets the necessary authorization header. ```java import com.squareup.okhttp.*; OkHttpClient client = new OkHttpClient(); HttpUrl.Builder urlBuilder = HttpUrl.parse("https://your_account_subdomain.zendesk.com/api/v2/api/v2/guide/medias") .newBuilder() .addQueryParameter("filter", "") .addQueryParameter("page", "") .addQueryParameter("sort", ""); 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(); ``` -------------------------------- ### Show OAuth Client - Python Example Source: https://developer.zendesk.com/api-reference/integration-services/connections/oauth_clients Demonstrates how to get OAuth client information using Python's requests library. This snippet shows the request setup and execution. ```python import requests url = "https://support.zendesk.com/api/services/zis/connections/oauth/clients/my_integration/2fea765a-5ae4-4e3b-b457-a4f7836d041b" headers = { "Content-Type": "application/json", } response = requests.request( "GET", url, headers=headers ) print(response.text) ``` -------------------------------- ### Show App Installation (Ruby) Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This Ruby code snippet shows how to fetch app installation details using Net::HTTP. It constructs the URI, sets the necessary headers including Basic Authentication with Base64 encoded credentials, and sends the GET request. ```ruby require "net/http" require "base64" uri = URI("https://support.zendesk.com/api/v2/apps/installations/1") 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 ``` -------------------------------- ### Search Guide Content with Multiple Parameters Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/help_center_search This example demonstrates how to search Zendesk Guide content using multiple filter parameters and a query. It shows how to construct the URL with various filters like brand IDs, category IDs, content types, locales, and a search query. ```bash curl -G "https://{subdomain}.zendesk.com/api/v2/guide/search" \ --data-urlencode "query=Printing" \ --data-urlencode "filter[locales]=en-us,en-gb" \ -v -u {email_address}/token:{api_token} ``` -------------------------------- ### Get Dynamic Content Item Variant (Node.js) Source: https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content_item_variants This Node.js example uses Axios to fetch a dynamic content item variant. Ensure you have Axios installed and replace the placeholder authentication value. ```Node.js var axios = require('axios'); var config = { method: 'GET', url: 'https://example.zendesk.com/api/v2/dynamic_content/items/47/variants/23', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ', // Base64 encoded "{email_address}/token:{api_token}" }, }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### Show Bundle by UUID - Go Example Source: https://developer.zendesk.com/api-reference/integration-services/registry/bundles Shows how to fetch bundle details using Go's net/http package. Requires basic authentication setup. ```go import ( "fmt" "io" "net/http" ) func main() { url := "https://support.zendesk.com/api/services/zis/registry/my_integration/bundles/543a30ec-c7af-4385-a516-7d05e446c12c" 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 ") // 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))} ``` -------------------------------- ### List External Content Types (Node.js) Source: https://developer.zendesk.com/api-reference/help_center/federated-search/external_content_types This Node.js example uses the axios library to make a GET request to list external content types. Ensure you have axios installed and replace the authentication placeholder. ```Node.js var axios = require('axios'); var config = { method: 'GET', url: 'https://support.zendesk.com/api/v2/guide/external_content/types', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ', // Base64 encoded "{email_address}/token:{api_token}" }, params: { 'page': '', }, }; axios(config).then(function (response) { console.log(JSON.stringify(response.data)); }).catch(function (error) { console.log(error); }); ``` -------------------------------- ### Example Response: 200 OK Source: https://developer.zendesk.com/api-reference/integration-services/configs/configs This is an example of a successful response (200 OK) when retrieving integration configurations. It includes details about the configurations, pagination links, and metadata. ```JSON // Status 200 OK { "configs": [ { "config": { "description": "A config object can be anything, this is an example.", "id": 999, "name": "my_config" }, "created_at": "2021-08-30T04:40:17Z", "id": 1, "integration": "my_integration", "scope": "my_scope", "updated_at": "2021-08-31T04:40:17Z", "zendesk_account_id": 123 } ], "links": { "next": "" }, "meta": { "has_more": true }, "next": null } ``` -------------------------------- ### App Installation Location JSON Example Source: https://developer.zendesk.com/api-reference/ticketing/apps/app_location_installations This is an example of the JSON format used to represent app installation locations, specifying an array of app installation IDs and a location name. ```json { "installations": [ 8765, 5678 ], "location_name": "nav_bar" } ``` -------------------------------- ### Get Engagement by ID - Python Example Source: https://developer.zendesk.com/api-reference/agent-availability/omnichannel-engagements/omnichannel_engagements Example in Python using the requests library to get engagement details. Shows how to set up basic authentication and headers for the GET request. ```python import requests from requests.auth import HTTPBasicAuth url = "https://support.zendesk.com/api/v2/engagements/R6vTXhl.agent:980824.y7Q4aI" 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) ``` -------------------------------- ### Create Section (Go) Source: https://developer.zendesk.com/api-reference/help_center/help-center-api/sections Example of creating a Help Center section using Go. Ensure you handle authentication and error responses appropriately. ```Go import ( "fmt" "io" "net/http" ) func main() { url := "https://support.zendesk.com/api/v2/help_center/categories/360002011513/sections" 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 ") // 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)) } ``` -------------------------------- ### Install App via Go Source: https://developer.zendesk.com/api-reference/ticketing/apps/apps This Go code snippet demonstrates how to install an app using the Zendesk API. It includes setting the correct headers and authorization. ```go import ( "fmt" "io" "net/http" ) func main() { url := "https://support.zendesk.com/api/v2/apps/installations" 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 ") // 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)) } ```