Use this API to get various metrics about one or more tickets in the Zendesk account.

JSON format

Ticket Metrics are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
agent_wait_time_in_minutes object true false Number of minutes the agent spent waiting during calendar and business hours
assigned_at string true false When the ticket was assigned
assignee_stations integer true false Number of assignees the ticket had
assignee_updated_at string true false When the assignee last updated the ticket
created_at string true false When the record was created
custom_status_updated_at string true false The date and time the ticket's custom status was last updated
first_resolution_time_in_minutes object true false Number of minutes to the first resolution time during calendar and business hours
full_resolution_time_in_minutes object true false Number of minutes to the full resolution during calendar and business hours
group_stations integer true false Number of groups the ticket passed through
id integer true false Automatically assigned when the client is created
initially_assigned_at string true false When the ticket was initially assigned
latest_comment_added_at string true false When the latest comment was added
on_hold_time_in_minutes object true false Number of minutes on hold
reopens integer true false Total number of times the ticket was reopened
replies integer true false The number of public replies added to a ticket by an agent
reply_time_in_minutes object true false Number of minutes to the first reply during calendar and business hours
reply_time_in_seconds object true false Number of seconds to the first reply during calendar hours, only available for Messaging tickets
requester_updated_at string true false When the requester last updated the ticket
requester_wait_time_in_minutes object true false Number of minutes the requester spent waiting during calendar and business hours
solved_at string true false When the ticket was solved
status_updated_at string true false When the status of the ticket was last updated
ticket_id integer true false Id of the associated ticket
updated_at string true false When the record was last updated
url string true false The API url of the ticket metric

Example

             
{"agent_wait_time_in_minutes":{"business":737,"calendar":2391},"assigned_at":"2011-05-05T10:38:52Z","assignee_stations":1,"assignee_updated_at":"2011-05-06T10:38:52Z",“created_at”:"2009-07-20T22:55:29Z","custom_status_updated_at":"2011-05-09T10:38:52Z","first_resolution_time_in_minutes":{"business":737,"calendar":2391},"full_resolution_time_in_minutes":{"business":737,"calendar":2391},"group_stations":7,"id":33,“initially_assigned_at”:"2011-05-03T10:38:52Z","latest_comment_added_at":"2011-05-09T10:38:52Z","on_hold_time_in_minutes":{"business":637,"calendar":2290},"reopens":55,"replies":322,"reply_time_in_minutes":{"business":737,"calendar":2391},"reply_time_in_seconds":{"calendar":143460},"requester_updated_at":"2011-05-07T10:38:52Z","requester_wait_time_in_minutes":{"business":737,"calendar":2391},"solved_at":"2011-05-09T10:38:52Z","status_updated_at":"2011-05-04T10:38:52Z","ticket_id":4343,"updated_at":"2011-05-05T10:38:52Z"}

List Ticket Metrics

  • GET /api/v2/ticket_metrics

Returns a list of tickets with their metrics.

Tickets are ordered chronologically by created date, from newest to oldest. The last ticket listed may not be the absolute oldest ticket in your account due to ticket archiving.

Archived tickets are not included in the response. SeeAbout archived ticketsin Zendesk help.

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

SeePagination.

Returns a maximum of 100 records per page.

Allowed For

  • Agents

Code Samples

旋度
              
旋度https://{subdomain}.zendesk.com/api/v2/ticket_metrics\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:=“https://example.亚博zendesk.com/api/v2/ticket_metrics"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/ticket_metrics").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/ticket_metrics',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.数据));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl=“https://example.亚博zendesk.com/api/v2/ticket_metrics"headers={"Content-Type":"application/json",}response=requests.request("GET",url,身份验证=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI(“https://example.亚博zendesk.com/api/v2/ticket_metrics")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{"ticket_metrics":[{"agent_wait_time_in_minutes":{"business":0,"calendar":0},"assigned_at":"2020-07-20T06:21:26Z","assignee_stations":0,"assignee_updated_at":"2020-07-20T06:21:26Z",“created_at”:"2020-07-21T01:01:42Z","first_resolution_time_in_minutes":{"business":0,"calendar":0},"full_resolution_time_in_minutes":{"business":0,"calendar":0},"group_stations":0,"id":33,“initially_assigned_at”:"2020-07-20T06:21:26Z","latest_comment_added_at":"2020-07-21T01:17:16Z","on_hold_time_in_minutes":{"business":0,"calendar":0},"reopens":0,"replies":1,"reply_time_in_minutes":{"business":16,"calendar":16},"reply_time_in_seconds":{"calendar":960},"requester_updated_at":"2020-07-21T01:17:16Z","requester_wait_time_in_minutes":{"business":0,"calendar":0},"solved_at":"2020-07-20T06:21:26Z","status_updated_at":"2020-07-21T01:01:41Z","ticket_id":1517,"updated_at":"2020-07-21T01:17:16Z","url":“https://example.亚博zendesk.com/api/v2/ticket_metrics/33.json"},{"agent_wait_time_in_minutes":{"business":0,"calendar":0},"assigned_at":"2020-07-20T06:21:26Z","assignee_stations":0,"assignee_updated_at":"2020-07-20T06:21:26Z",“created_at”:"2020-07-20T06:21:27Z","first_resolution_time_in_minutes":{"business":0,"calendar":0},"full_resolution_time_in_minutes":{"business":0,"calendar":0},"group_stations":0,"id":34,“initially_assigned_at”:"2020-07-20T06:21:26Z","latest_comment_added_at":"2020-07-20T06:21:26Z","on_hold_time_in_minutes":{"business":0,"calendar":0},"reopens":0,"replies":0,"reply_time_in_minutes":{"business":0,"calendar":0},"reply_time_in_seconds":{"calendar":0},"requester_updated_at":"2020-07-20T06:21:26Z","requester_wait_time_in_minutes":{"business":0,"calendar":0},"solved_at":"2020-07-20T06:21:26Z","status_updated_at":"2020-07-20T06:21:26Z","ticket_id":1511,"updated_at":"2020-07-20T06:21:27Z","url":“https://example.亚博zendesk.com/api/v2/ticket_metrics/34.json"}]}

Show Ticket Metrics

  • GET /api/v2/ticket_metrics/{ticket_metric_id}
  • GET /api/v2/tickets/{ticket_id}/metrics

Returns a specific metric, or the metrics of a specific ticket.

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

SeePagination.

Returns a maximum of 100 records per page.

Allowed For

  • Agents

Parameters

Name Type In Required Description
ticket_metric_id string Path true The id of the ticket metric to retrieve

Code Samples

旋度
              
旋度https://{subdomain}.zendesk.com/api/v2/ticket_metrics/{ticket_metric_id}\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:=“https://example.亚博zendesk.com/api/v2/ticket_metrics/10001"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/ticket_metrics/10001").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/ticket_metrics/10001',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.数据));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl=“https://example.亚博zendesk.com/api/v2/ticket_metrics/10001"headers={"Content-Type":"application/json",}response=requests.request("GET",url,身份验证=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI(“https://example.亚博zendesk.com/api/v2/ticket_metrics/10001")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{"ticket_metric":[{"agent_wait_time_in_minutes":{"business":0,"calendar":0},"assigned_at":"2020-07-20T06:21:26Z","assignee_stations":0,"assignee_updated_at":"2020-07-20T06:21:26Z",“created_at”:"2020-07-21T01:01:42Z","first_resolution_time_in_minutes":{"business":0,"calendar":0},"full_resolution_time_in_minutes":{"business":0,"calendar":0},"group_stations":0,"id":33,“initially_assigned_at”:"2020-07-20T06:21:26Z","latest_comment_added_at":"2020-07-21T01:17:16Z","on_hold_time_in_minutes":{"business":0,"calendar":0},"reopens":0,"replies":1,"reply_time_in_minutes":{"business":16,"calendar":16},"reply_time_in_seconds":{"calendar":960},"requester_updated_at":"2020-07-21T01:17:16Z","requester_wait_time_in_minutes":{"business":0,"calendar":0},"solved_at":"2020-07-20T06:21:26Z","status_updated_at":"2020-07-21T01:01:41Z","ticket_id":1517,"updated_at":"2020-07-21T01:17:16Z","url":“https://example.亚博zendesk.com/api/v2/ticket_metrics/33.json"}]}