DataFlex / Support API / Show Ticket Metrics
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sBusiness
String sCalendar
String sAssigned_at
String sAssignee_stations
String sAssignee_updated_at
String sCreated_at
String sCustom_status_updated_at
String sFirst_resolution_time_in_minutesBusiness
String sFirst_resolution_time_in_minutesCalendar
String sFull_resolution_time_in_minutesBusiness
String sFull_resolution_time_in_minutesCalendar
String sGroup_stations
String sId
String sInitially_assigned_at
String sLatest_comment_added_at
String sOn_hold_time_in_minutesBusiness
String sOn_hold_time_in_minutesCalendar
String sReopens
String sReplies
String sReply_time_in_minutesBusiness
String sReply_time_in_minutesCalendar
String sReply_time_in_secondsBusiness
String sReply_time_in_secondsCalendar
String sRequester_updated_at
String sRequester_wait_time_in_minutesBusiness
String sRequester_wait_time_in_minutesCalendar
String sSolved_at
String sStatus_updated_at
String sTicket_id
String sUpdated_at
String sUrl
Integer i
Integer iCount_i
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "login"
Set ComPassword Of hoHttp To "password"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://example.zendesk.com/api/v2/ticket_metrics/:ticket_metric_id" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// 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
Move 0 To i
Get ComSizeOfArray Of hoJResp "ticket_metric" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "ticket_metric[i].agent_wait_time_in_minutes.business" To sBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].agent_wait_time_in_minutes.calendar" To sCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].assigned_at" To sAssigned_at
Get ComStringOf Of hoJResp "ticket_metric[i].assignee_stations" To sAssignee_stations
Get ComStringOf Of hoJResp "ticket_metric[i].assignee_updated_at" To sAssignee_updated_at
Get ComStringOf Of hoJResp "ticket_metric[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "ticket_metric[i].custom_status_updated_at" To sCustom_status_updated_at
Get ComStringOf Of hoJResp "ticket_metric[i].first_resolution_time_in_minutes.business" To sFirst_resolution_time_in_minutesBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].first_resolution_time_in_minutes.calendar" To sFirst_resolution_time_in_minutesCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].full_resolution_time_in_minutes.business" To sFull_resolution_time_in_minutesBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].full_resolution_time_in_minutes.calendar" To sFull_resolution_time_in_minutesCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].group_stations" To sGroup_stations
Get ComStringOf Of hoJResp "ticket_metric[i].id" To sId
Get ComStringOf Of hoJResp "ticket_metric[i].initially_assigned_at" To sInitially_assigned_at
Get ComStringOf Of hoJResp "ticket_metric[i].latest_comment_added_at" To sLatest_comment_added_at
Get ComStringOf Of hoJResp "ticket_metric[i].on_hold_time_in_minutes.business" To sOn_hold_time_in_minutesBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].on_hold_time_in_minutes.calendar" To sOn_hold_time_in_minutesCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].reopens" To sReopens
Get ComStringOf Of hoJResp "ticket_metric[i].replies" To sReplies
Get ComStringOf Of hoJResp "ticket_metric[i].reply_time_in_minutes.business" To sReply_time_in_minutesBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].reply_time_in_minutes.calendar" To sReply_time_in_minutesCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].reply_time_in_seconds.business" To sReply_time_in_secondsBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].reply_time_in_seconds.calendar" To sReply_time_in_secondsCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].requester_updated_at" To sRequester_updated_at
Get ComStringOf Of hoJResp "ticket_metric[i].requester_wait_time_in_minutes.business" To sRequester_wait_time_in_minutesBusiness
Get ComStringOf Of hoJResp "ticket_metric[i].requester_wait_time_in_minutes.calendar" To sRequester_wait_time_in_minutesCalendar
Get ComStringOf Of hoJResp "ticket_metric[i].solved_at" To sSolved_at
Get ComStringOf Of hoJResp "ticket_metric[i].status_updated_at" To sStatus_updated_at
Get ComStringOf Of hoJResp "ticket_metric[i].ticket_id" To sTicket_id
Get ComStringOf Of hoJResp "ticket_metric[i].updated_at" To sUpdated_at
Get ComStringOf Of hoJResp "ticket_metric[i].url" To sUrl
Move (i + 1) To i
Loop
End_Procedure
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}"
}
]
}