Stats
Use this API to get statistics about the current queue, your account, your agents, or their activity.
The timeframe of the data returned by all endpoints is the current day, from midnight in your account's timezone to the moment you make the request.
For example, if your account is set to Pacific Time (GMT-7) and you make a request at 07:02 a.m. in that timezone, then the timeframe of the data is as follows:
from: Mon, 11 Jun 2018 00:00:00 PDT -07:00
to: Mon, 11 Jun 2018 07:02:43 PDT -07:00
Show Account Overview
GET /api/v2/channels/voice/stats/account_overview
Optionally, you can filter the results by phone numbers.
Allowed For
- Agents
JSON Format
Account overview statistics are represented by a JSON object with the following properties:
Name | Type | Description |
---|---|---|
average_call_duration | integer | Average time of call across all calls |
average_queue_wait_time | integer | Average time caller spent in queue waiting to be routed to an agent |
average_wrap_up_time | integer | Average wrap-up time across all calls |
max_calls_waiting | integer | Maximum number of calls waiting for an agent in the queue, including caller on the line and callback requests |
max_queue_wait_time | integer | Maximum time caller spent in queue waiting to be routed to an agent |
total_call_duration | integer | Total duration of all calls |
total_calls | integer | Total number of inbound and outbound calls |
total_voicemails | integer | Total number of calls that went to voicemail for any reason |
total_wrap_up_time | integer | Total wrap-up time across all calls |
Example
{
"average_call_duration": 33,
"average_queue_wait_time": 1,
"average_wrap_up_time": 1,
"max_calls_waiting": 1,
"max_queue_wait_time": 10,
"total_call_duration": 41,
"total_calls": 39,
"total_voicemails": 12,
"total_wrap_up_time": 11
}
JSON Format (Professional plan and above)
On the Professional plan and above, the JSON object has the following additional properties:
Name | Type | Description |
---|---|---|
average_callback_wait_time | integer | Average callback time a customer has been waiting for an agent in the queue. Excludes Available agents greeting |
average_hold_time | integer | Average time caller spent on hold per call |
average_time_to_answer | integer | Average time between system answering a call and customer being connected with an agent. Includes greetings and other recordings played |
total_callback_calls | integer | Total number of callback requests (successful or not) |
total_calls_abandoned_in_queue | integer | Total number of calls where customer hung up while waiting in the queue |
total_calls_outside_business_hours | integer | Total number of calls received outside business hours |
total_calls_with_exceeded_queue_wait_time | integer | Total number of calls sent to voicemail after exceeding the max wait time in the queue |
total_calls_with_requested_voicemail | integer | Total number of calls where customer requested to be put through to voicemail by dialing 1 |
total_hold_time | integer | Total hold time across all calls |
total_inbound_calls | integer | Total number of inbound calls |
total_outbound_calls | integer | Total number of outbound calls |
total_textback_requests | integer | Total number of textback messages sent from IVR |
total_embeddable_callback_calls | integer | Total number of callback calls requested via Web Widget (successful or not) |
Example
{
"average_call_duration": 33,
"average_queue_wait_time": 1,
"average_wrap_up_time": 1,
"max_calls_waiting": 1,
"max_queue_wait_time": 10,
"total_call_duration": 41,
"total_calls": 39,
"total_voicemails": 12,
"total_wrap_up_time": 11,
"average_callback_wait_time": 0,
"average_hold_time": 0,
"average_time_to_answer": 2,
"total_callback_calls": 0,
"total_calls_abandoned_in_queue": 2,
"total_calls_outside_business_hours": 0,
"total_calls_with_exceeded_queue_wait_time": 0,
"total_calls_with_requested_voicemail": 0,
"total_hold_time": 0,
"total_inbound_calls": 34,
"total_outbound_calls": 5,
"total_textback_requests": 0,
"total_embeddable_callback_calls": 1,
}
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
phone_number_ids | array | Query | false | Ids of phone numbers to filter results with. Accepts a comma-separated list of up to 100 phone number ids. |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/account_overview.json \
-v -u {email_address}/token:{api_token}
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/current_queue_activity.json?phone_number_ids=1,2,3 \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/channels/voice/stats/account_overview?phone_number_ids="
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 "{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))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/stats/account_overview")
.newBuilder()
.addQueryParameter("phone_number_ids", "");
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();
Nodejs
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 <auth-value>', // 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);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/channels/voice/stats/account_overview?phone_number_ids="
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)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/channels/voice/stats/account_overview")
uri.query = URI.encode_www_form("phone_number_ids": "")
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(s)
200 OK
// Status 200 OK
{
"account_overview": {
"average_call_duration": 33,
"average_callback_wait_time": 0,
"average_hold_time": 0,
"average_queue_wait_time": 1,
"average_time_to_answer": 2,
"average_wrap_up_time": 1,
"max_calls_waiting": 1,
"max_queue_wait_time": 10,
"total_call_duration": 41,
"total_callback_calls": 0,
"total_calls": 39,
"total_calls_abandoned_in_queue": 2,
"total_calls_outside_business_hours": 0,
"total_calls_with_exceeded_queue_wait_time": 0,
"total_calls_with_requested_voicemail": 0,
"total_embeddable_callback_calls": 0,
"total_hold_time": 0,
"total_inbound_calls": 34,
"total_outbound_calls": 5,
"total_textback_requests": 0,
"total_voicemails": 12,
"total_wrap_up_time": 11
}
}
List Agents Activity
GET /api/v2/channels/voice/stats/agents_activity
Allowed For
- Agents
Agents activity is represented by a JSON object with the following properties:
Name | Type | Description |
---|---|---|
agent_id | string | The agent's id |
agent_state | string | The agent's state. Allowed values are "online", "offline", "away", or "transfers_only" |
available_time | integer | Total time agent was available to answer calls and set to "online". Does not include time on calls or in wrap-up mode |
avatar_url | string | The URL to agent's avatar |
away_time | integer | Total time agent's status was set to "away" |
call_status | string | The agent's call status. Allowed values are "on_call", "wrap_up", or "null" |
calls_accepted | integer | The total number of phone calls the agent has accepted |
calls_denied | integer | The total number of times the agent has declined an incoming call |
calls_missed | integer | The total number of times an agent has not answered their phone and the call was routed to the next available agent |
forwarding_number | string | The forwarding number set up by the agent, or null if the agent has no forwarding number |
name | string | The agent's name |
online_time | integer | Total time agent's status was set to "online", "away", or "transfers_only" |
transfers_only_time | integer | Total time agent's status was set to "transfers_only" |
total_call_duration | integer | Total time the agent was on call across all calls |
total_talk_time | integer | Total talk time (excludes hold time and consultation) |
total_wrap_up_time | integer | Total time spent in wrap-up across all calls |
via | string | The channel (client/phone) the agent is registered on |
Example
{
"agent_id": 1,
"agent_state": "online",
"available_time": 3600,
"avatar_url": "https://path_to_avatar.png",
"away_time": 250,
"call_status": null,
"calls_accepted": 5,
"calls_denied": 1,
"calls_missed": 1,
"forwarding_number": "+1234567890",
"name": "Johnny Agent",
"online_time": 5600,
"transfers_only_time": 123,
"total_call_duration": 121,
"total_talk_time": 87,
"total_wrap_up_time": 68,
"via": "phone"
}
On the Professional plan and above, the JSON object has the following additional properties:
Name | Type | Description |
---|---|---|
accepted_third_party_conferences | integer | The average number of conference calls accepted, the number accepted by the selected agent, and the percentage difference between the two |
accepted_transfers | integer | Total numbers of transfers the agent accepted |
average_hold_time | integer | Average time the agent spent on hold per call |
average_talk_time | integer | Average talk time across all calls (excludes hold time and consultation) |
average_wrap_up_time | integer | Average wrap-up time across all calls |
calls_put_on_hold | integer | Total number of calls the agent placed on hold |
started_third_party_conferences | integer | The average number of conference calls initiated, the number initiated by the selected agent, and the percentage difference between the two |
started_transfers | integer | Total numbers of transfers the agent started |
total_hold_time | integer | Total time the agent was on hold across all calls |
Example
{
"accepted_third_party_conferences": 0,
"accepted_transfers": 5,
"agent_id": 1,
"available_time": 3600,
"avatar_url": "https://path_to_avatar.png",
"average_hold_time": 10,
"average_talk_time": 25,
"average_wrap_up_time": 39,
"calls_accepted": 5,
"calls_denied": 1,
"calls_missed": 1,
"calls_put_on_hold": 8,
"forwarding_number": "+1234567890",
"name": "Johnny Agent",
"online_time": 5600,
"transfers_only_time": 123,
"started_third_party_conferences": 0,
"started_transfers": 2,
"total_call_duration": 121,
"total_hold_time": 27,
"total_talk_time": 87,
"total_wrap_up_time": 68,
"via": "phone"
}
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
group_ids | array | Query | false | The ids of groups to filter results with. Accepts a comma-separated list of up to 100 group ids. |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/agents_activity.json \
-v -u {email_address}/token:{api_token}
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/agents_activity.json?group_ids=1,2,3 \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/channels/voice/stats/agents_activity?group_ids=%5B1%2C2%5D"
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 "{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))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/stats/agents_activity")
.newBuilder()
.addQueryParameter("group_ids", "[1,2]");
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();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/channels/voice/stats/agents_activity',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
params: {
'group_ids': '%5B1%2C2%5D',
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/channels/voice/stats/agents_activity?group_ids=%5B1%2C2%5D"
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)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/channels/voice/stats/agents_activity")
uri.query = URI.encode_www_form("group_ids": "[1,2]")
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(s)
200 OK
// Status 200 OK
{
"agents_activity": [
{
"agent_id": 1,
"available_time": 3600,
"avatar_url": "https://path_to_avatar.png",
"calls_accepted": 5,
"calls_denied": 1,
"calls_missed": 1,
"forwarding_number": "+1234567890",
"name": "Johnny Agent",
"online_time": 5600,
"total_call_duration": 121,
"total_talk_time": 87,
"total_wrap_up_time": 68,
"transfers_only_time": 123,
"via": "phone"
}
],
"count": 1,
"next_page": null,
"previous_page": null
}
Show Agents Overview
GET /api/v2/channels/voice/stats/agents_overview
Allowed For
- Agents
Agents overview statistics are represented by a JSON object with the following properties:
Name | Type | Description |
---|---|---|
average_wrap_up_time | integer | Average wrap-up time across all calls |
total_calls_accepted | integer | Total number of calls agents answered |
total_calls_denied | integer | Total number of calls agents denied |
total_calls_missed | integer | Total number of calls agents missed |
total_talk_time | integer | Total talk time across all calls (excludes hold time and consultation) |
total_wrap_up_time | integer | Total wrap-up time across all calls |
Note: Metrics like total_calls_accepted
, total_calls_denied
, total_calls_missed
, and total_calls_put_on_hold
can be greater than total_inbound_calls
. Example: One inbound call is missed by two agents or denied by two agents.
Example
{
"average_wrap_up_time": 120,
"total_calls_accepted": 41,
"total_calls_denied": 39,
"total_calls_missed": 12,
"total_talk_time": 31,
"total_wrap_up_time": 13
}
On the Professional plan and above, the JSON object has the following additional properties:
Name | Type | Description |
---|---|---|
average_accepted_transfers | integer | Average number of transfers agents accepted |
average_available_time | integer | Average time an agent was available to answer calls and set to "online". Does not include time on calls or in wrap-up mode |
average_away_time | integer | Average time agent's status was set to "away" |
average_calls_accepted | integer | Average number of calls agents answered |
average_calls_denied | integer | Average number of calls agents denied |
average_calls_missed | integer | Average number of calls agents missed |
average_calls_put_on_hold | integer | Average number of calls an agent placed on hold |
average_hold_time | integer | Average time caller spent on hold per call |
average_online_time | integer | Average time agent's status was set to "online", "away", or "transfers_only" |
average_transfers_only_time | integer | Average time agent's status was set to "transfers only" |
average_started_transfers | integer | Average number of transfers agents started |
average_talk_time | integer | Average agent talk time across all calls (excludes hold time and consultation) |
total_accepted_transfers | integer | Total number of transfers agents started |
total_calls_put_on_hold | integer | Total number of calls agents placed on hold |
total_hold_time | integer | Total hold time across all calls |
total_started_transfers | integer | Total number of transfers agents started |
Example
{
"average_accepted_transfers": 8,
"average_available_time": 2100,
"average_away_time": 4438,
"average_calls_accepted": 14,
"average_calls_denied": 4,
"average_calls_missed": 3,
"average_calls_put_on_hold": 14,
"average_hold_time": 35,
"average_online_time": 3600,
"average_transfers_only_time":123,
"average_started_transfers": 12,
"average_talk_time": 67,
"average_wrap_up_time": 120,
"total_accepted_transfers": 12,
"total_calls_accepted": 41,
"total_calls_denied": 39,
"total_calls_missed": 12,
"total_calls_put_on_hold": 5,
"total_hold_time": 120,
"total_started_transfers": 17,
"total_talk_time": 31,
"total_wrap_up_time": 13
}
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/agents_overview.json \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/channels/voice/stats/agents_overview"
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 "{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))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/stats/agents_overview")
.newBuilder();
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();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/channels/voice/stats/agents_overview',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/channels/voice/stats/agents_overview"
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)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/channels/voice/stats/agents_overview")
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(s)
200 OK
// Status 200 OK
{
"agents_overview": {
"average_accepted_transfers": 8,
"average_available_time": 2100,
"average_away_time": 210,
"average_calls_accepted": 14,
"average_calls_denied": 4,
"average_calls_missed": 3,
"average_calls_put_on_hold": 14,
"average_hold_time": 35,
"average_online_time": 3600,
"average_started_transfers": 12,
"average_talk_time": 67,
"average_transfers_only_time": 123,
"average_wrap_up_time": 120,
"total_accepted_transfers": 12,
"total_calls_accepted": 41,
"total_calls_denied": 39,
"total_calls_missed": 12,
"total_calls_put_on_hold": 5,
"total_hold_time": 120,
"total_started_transfers": 17,
"total_talk_time": 31,
"total_wrap_up_time": 13
}
}
Show Current Queue Activity
GET /api/v2/channels/voice/stats/current_queue_activity
Optionally or if you notice inconsistencies with the returned values, you can filter the results by phone numbers.
Allowed For
- Agents
Rate Limit
You can make up to 2,500 requests every 5 minutes to this endpoint.
Name | Type | Description |
---|---|---|
agents_online | integer | The current number of agents online or away, including those on call and on wrap up |
average_wait_time | integer | The average wait time for all callers who are waiting for an available agent (in seconds) |
callbacks_waiting | integer | The current number of callers in the callback queue waiting for the next available support agent |
calls_waiting | integer | The current number of callers in the queue waiting for the next available support agent |
embeddable_callbacks_waiting | integer | The current number of callback requests from Web Widget in the queue waiting for the next available support agent |
longest_wait_time | integer | The longest wait time for any caller in the queue (in seconds) |
Example
{
"agents_online": 1,
"average_wait_time": 5,
"calls_waiting": 1,
"callbacks_waiting": 3,
"embeddable_callbacks_waiting": 1,
"longest_wait_time": 10,
}
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
phone_number_ids | array | Query | false | Ids of phone numbers to filter results with. Accepts a comma-separated list of up to 100 phone number ids. |
Code Samples
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/current_queue_activity.json \
-v -u {email_address}/token:{api_token}
curl
curl https://{subdomain}.zendesk.com/api/v2/channels/voice/stats/current_queue_activity.json?phone_number_ids=1,2,3 \
-v -u {email_address}/token:{api_token}
Go
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://support.zendesk.com/api/v2/channels/voice/stats/current_queue_activity?phone_number_ids="
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 "{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))
}
Java
import com.squareup.okhttp.*;
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://support.zendesk.com/api/v2/channels/voice/stats/current_queue_activity")
.newBuilder()
.addQueryParameter("phone_number_ids", "");
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();
Nodejs
var axios = require('axios');
var config = {
method: 'GET',
url: 'https://support.zendesk.com/api/v2/channels/voice/stats/current_queue_activity',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic <auth-value>', // 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);
});
Python
import requests
from requests.auth import HTTPBasicAuth
url = "https://support.zendesk.com/api/v2/channels/voice/stats/current_queue_activity?phone_number_ids="
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)
Ruby
require "net/http"
require "base64"
uri = URI("https://support.zendesk.com/api/v2/channels/voice/stats/current_queue_activity")
uri.query = URI.encode_www_form("phone_number_ids": "")
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(s)
200 OK
// Status 200 OK
{
"current_queue_activity": {
"agents_online": 2,
"average_wait_time": 5,
"callbacks_waiting": 1,
"calls_waiting": 1,
"embeddable_callbacks_waiting": 1,
"longest_wait_time": 10
}
}