autoit / Support API / Show Ticket Metrics
Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oHttp.BasicAuth = True
$oHttp.Login = "login"
$oHttp.Password = "password"
$oHttp.SetRequestHeader "Accept","application/json"
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://example.zendesk.com/api/v2/ticket_metrics/:ticket_metric_id",$oSbResponseBody)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oHttp.LastHeader & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "ticket_metric": [
; {
; "agent_wait_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "assigned_at": "<dateTime>",
; "assignee_stations": "<integer>",
; "assignee_updated_at": "<dateTime>",
; "created_at": "<dateTime>",
; "custom_status_updated_at": "<dateTime>",
; "first_resolution_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "full_resolution_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "group_stations": "<integer>",
; "id": "<integer>",
; "initially_assigned_at": "<dateTime>",
; "latest_comment_added_at": "<dateTime>",
; "on_hold_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "reopens": "<integer>",
; "replies": "<integer>",
; "reply_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "reply_time_in_seconds": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "requester_updated_at": "<dateTime>",
; "requester_wait_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "solved_at": "<dateTime>",
; "status_updated_at": "<dateTime>",
; "ticket_id": "<integer>",
; "updated_at": "<dateTime>",
; "url": "<string>"
; },
; {
; "agent_wait_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "assigned_at": "<dateTime>",
; "assignee_stations": "<integer>",
; "assignee_updated_at": "<dateTime>",
; "created_at": "<dateTime>",
; "custom_status_updated_at": "<dateTime>",
; "first_resolution_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "full_resolution_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "group_stations": "<integer>",
; "id": "<integer>",
; "initially_assigned_at": "<dateTime>",
; "latest_comment_added_at": "<dateTime>",
; "on_hold_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "reopens": "<integer>",
; "replies": "<integer>",
; "reply_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "reply_time_in_seconds": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "requester_updated_at": "<dateTime>",
; "requester_wait_time_in_minutes": {
; "business": "<integer>",
; "calendar": "<integer>"
; },
; "solved_at": "<dateTime>",
; "status_updated_at": "<dateTime>",
; "ticket_id": "<integer>",
; "updated_at": "<dateTime>",
; "url": "<string>"
; }
; ]
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Local $sBusiness
Local $sCalendar
Local $sAssigned_at
Local $sAssignee_stations
Local $sAssignee_updated_at
Local $sCreated_at
Local $sCustom_status_updated_at
Local $sFirst_resolution_time_in_minutesBusiness
Local $sFirst_resolution_time_in_minutesCalendar
Local $sFull_resolution_time_in_minutesBusiness
Local $sFull_resolution_time_in_minutesCalendar
Local $sGroup_stations
Local $sId
Local $sInitially_assigned_at
Local $sLatest_comment_added_at
Local $sOn_hold_time_in_minutesBusiness
Local $sOn_hold_time_in_minutesCalendar
Local $sReopens
Local $sReplies
Local $sReply_time_in_minutesBusiness
Local $sReply_time_in_minutesCalendar
Local $sReply_time_in_secondsBusiness
Local $sReply_time_in_secondsCalendar
Local $sRequester_updated_at
Local $sRequester_wait_time_in_minutesBusiness
Local $sRequester_wait_time_in_minutesCalendar
Local $solved_at
Local $status_updated_at
Local $sTicket_id
Local $sUpdated_at
Local $sUrl
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("ticket_metric")
While $i < $iCount_i
$oJResp.I = $i
$sBusiness = $oJResp.StringOf("ticket_metric[i].agent_wait_time_in_minutes.business")
$sCalendar = $oJResp.StringOf("ticket_metric[i].agent_wait_time_in_minutes.calendar")
$sAssigned_at = $oJResp.StringOf("ticket_metric[i].assigned_at")
$sAssignee_stations = $oJResp.StringOf("ticket_metric[i].assignee_stations")
$sAssignee_updated_at = $oJResp.StringOf("ticket_metric[i].assignee_updated_at")
$sCreated_at = $oJResp.StringOf("ticket_metric[i].created_at")
$sCustom_status_updated_at = $oJResp.StringOf("ticket_metric[i].custom_status_updated_at")
$sFirst_resolution_time_in_minutesBusiness = $oJResp.StringOf("ticket_metric[i].first_resolution_time_in_minutes.business")
$sFirst_resolution_time_in_minutesCalendar = $oJResp.StringOf("ticket_metric[i].first_resolution_time_in_minutes.calendar")
$sFull_resolution_time_in_minutesBusiness = $oJResp.StringOf("ticket_metric[i].full_resolution_time_in_minutes.business")
$sFull_resolution_time_in_minutesCalendar = $oJResp.StringOf("ticket_metric[i].full_resolution_time_in_minutes.calendar")
$sGroup_stations = $oJResp.StringOf("ticket_metric[i].group_stations")
$sId = $oJResp.StringOf("ticket_metric[i].id")
$sInitially_assigned_at = $oJResp.StringOf("ticket_metric[i].initially_assigned_at")
$sLatest_comment_added_at = $oJResp.StringOf("ticket_metric[i].latest_comment_added_at")
$sOn_hold_time_in_minutesBusiness = $oJResp.StringOf("ticket_metric[i].on_hold_time_in_minutes.business")
$sOn_hold_time_in_minutesCalendar = $oJResp.StringOf("ticket_metric[i].on_hold_time_in_minutes.calendar")
$sReopens = $oJResp.StringOf("ticket_metric[i].reopens")
$sReplies = $oJResp.StringOf("ticket_metric[i].replies")
$sReply_time_in_minutesBusiness = $oJResp.StringOf("ticket_metric[i].reply_time_in_minutes.business")
$sReply_time_in_minutesCalendar = $oJResp.StringOf("ticket_metric[i].reply_time_in_minutes.calendar")
$sReply_time_in_secondsBusiness = $oJResp.StringOf("ticket_metric[i].reply_time_in_seconds.business")
$sReply_time_in_secondsCalendar = $oJResp.StringOf("ticket_metric[i].reply_time_in_seconds.calendar")
$sRequester_updated_at = $oJResp.StringOf("ticket_metric[i].requester_updated_at")
$sRequester_wait_time_in_minutesBusiness = $oJResp.StringOf("ticket_metric[i].requester_wait_time_in_minutes.business")
$sRequester_wait_time_in_minutesCalendar = $oJResp.StringOf("ticket_metric[i].requester_wait_time_in_minutes.calendar")
$solved_at = $oJResp.StringOf("ticket_metric[i].solved_at")
$status_updated_at = $oJResp.StringOf("ticket_metric[i].status_updated_at")
$sTicket_id = $oJResp.StringOf("ticket_metric[i].ticket_id")
$sUpdated_at = $oJResp.StringOf("ticket_metric[i].updated_at")
$sUrl = $oJResp.StringOf("ticket_metric[i].url")
$i = $i + 1
Wend
Curl Command
curl -u login:password -X GET
-H "Accept: application/json"
https://example.zendesk.com/api/v2/ticket_metrics/:ticket_metric_id
Postman Collection Item JSON
{
"name": "Show Ticket Metrics",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/ticket_metrics/:ticket_metric_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"ticket_metrics",
":ticket_metric_id"
],
"variable": [
{
"key": "ticket_metric_id",
"value": "<string>"
}
]
},
"description": "Returns a specific metric, or the metrics of a specific ticket.\n\n#### Pagination\n\n- Cursor pagination (recommended)\n- Offset pagination\n\nSee [Pagination](/api-reference/introduction/pagination/).\n\nReturns a maximum of 100 records per page.\n\n#### Allowed For\n\n* Agents\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/ticket_metrics/:ticket_metric_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"ticket_metrics",
":ticket_metric_id"
],
"variable": [
{
"key": "ticket_metric_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"ticket_metric\": [\n {\n \"agent_wait_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"assigned_at\": \"<dateTime>\",\n \"assignee_stations\": \"<integer>\",\n \"assignee_updated_at\": \"<dateTime>\",\n \"created_at\": \"<dateTime>\",\n \"custom_status_updated_at\": \"<dateTime>\",\n \"first_resolution_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"full_resolution_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"group_stations\": \"<integer>\",\n \"id\": \"<integer>\",\n \"initially_assigned_at\": \"<dateTime>\",\n \"latest_comment_added_at\": \"<dateTime>\",\n \"on_hold_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"reopens\": \"<integer>\",\n \"replies\": \"<integer>\",\n \"reply_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"reply_time_in_seconds\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"requester_updated_at\": \"<dateTime>\",\n \"requester_wait_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"solved_at\": \"<dateTime>\",\n \"status_updated_at\": \"<dateTime>\",\n \"ticket_id\": \"<integer>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\"\n },\n {\n \"agent_wait_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"assigned_at\": \"<dateTime>\",\n \"assignee_stations\": \"<integer>\",\n \"assignee_updated_at\": \"<dateTime>\",\n \"created_at\": \"<dateTime>\",\n \"custom_status_updated_at\": \"<dateTime>\",\n \"first_resolution_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"full_resolution_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"group_stations\": \"<integer>\",\n \"id\": \"<integer>\",\n \"initially_assigned_at\": \"<dateTime>\",\n \"latest_comment_added_at\": \"<dateTime>\",\n \"on_hold_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"reopens\": \"<integer>\",\n \"replies\": \"<integer>\",\n \"reply_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"reply_time_in_seconds\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"requester_updated_at\": \"<dateTime>\",\n \"requester_wait_time_in_minutes\": {\n \"business\": \"<integer>\",\n \"calendar\": \"<integer>\"\n },\n \"solved_at\": \"<dateTime>\",\n \"status_updated_at\": \"<dateTime>\",\n \"ticket_id\": \"<integer>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\"\n }\n ]\n}"
}
]
}