DataFlex / Support API / List Custom Ticket Statuses
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vQueryParams
Handle hoQueryParams
Variant vResp
Handle hoResp
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sStatus_category
String sAgent_label
String sActive
String sCreated_at
String sDefault
String sDescription
String sEnd_user_description
String sEnd_user_label
String sId
String sRaw_agent_label
String sRaw_description
String sRaw_end_user_description
String sRaw_end_user_label
String sUpdated_at
Integer i
Integer iCount_i
String sTemp1
Boolean bTemp1
// 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"
Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
If (Not(IsComObjectCreated(hoQueryParams))) Begin
Send CreateComObject of hoQueryParams
End
Get ComUpdateString Of hoQueryParams "status_categories" "<string>" To iSuccess
Get ComUpdateString Of hoQueryParams "active" "<boolean>" To iSuccess
Get ComUpdateString Of hoQueryParams "default" "<boolean>" To iSuccess
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get pvComObject of hoQueryParams to vQueryParams
Get ComQuickRequestParams Of hoHttp "GET" "https://example.zendesk.com/api/v2/custom_statuses" vQueryParams To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess
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 ComStatusCode Of hoResp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComHeader Of hoResp To sTemp1
Showln sTemp1
Showln "Failed."
Send Destroy of hoResp
Procedure_Return
End
Send Destroy of hoResp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "custom_statuses": [
// {
// "status_category": "pending",
// "agent_label": "<string>",
// "active": "<boolean>",
// "created_at": "<dateTime>",
// "default": "<boolean>",
// "description": "<string>",
// "end_user_description": "<string>",
// "end_user_label": "<string>",
// "id": "<integer>",
// "raw_agent_label": "<string>",
// "raw_description": "<string>",
// "raw_end_user_description": "<string>",
// "raw_end_user_label": "<string>",
// "updated_at": "<dateTime>"
// },
// {
// "status_category": "hold",
// "agent_label": "<string>",
// "active": "<boolean>",
// "created_at": "<dateTime>",
// "default": "<boolean>",
// "description": "<string>",
// "end_user_description": "<string>",
// "end_user_label": "<string>",
// "id": "<integer>",
// "raw_agent_label": "<string>",
// "raw_description": "<string>",
// "raw_end_user_description": "<string>",
// "raw_end_user_label": "<string>",
// "updated_at": "<dateTime>"
// }
// ]
// }
// 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 "custom_statuses" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "custom_statuses[i].status_category" To sStatus_category
Get ComStringOf Of hoJResp "custom_statuses[i].agent_label" To sAgent_label
Get ComStringOf Of hoJResp "custom_statuses[i].active" To sActive
Get ComStringOf Of hoJResp "custom_statuses[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "custom_statuses[i].default" To sDefault
Get ComStringOf Of hoJResp "custom_statuses[i].description" To sDescription
Get ComStringOf Of hoJResp "custom_statuses[i].end_user_description" To sEnd_user_description
Get ComStringOf Of hoJResp "custom_statuses[i].end_user_label" To sEnd_user_label
Get ComStringOf Of hoJResp "custom_statuses[i].id" To sId
Get ComStringOf Of hoJResp "custom_statuses[i].raw_agent_label" To sRaw_agent_label
Get ComStringOf Of hoJResp "custom_statuses[i].raw_description" To sRaw_description
Get ComStringOf Of hoJResp "custom_statuses[i].raw_end_user_description" To sRaw_end_user_description
Get ComStringOf Of hoJResp "custom_statuses[i].raw_end_user_label" To sRaw_end_user_label
Get ComStringOf Of hoJResp "custom_statuses[i].updated_at" To sUpdated_at
Move (i + 1) To i
Loop
End_Procedure
Curl Command
curl -u login:password -G -d "status_categories=%3Cstring%3E"
-d "active=%3Cboolean%3E"
-d "default=%3Cboolean%3E"
-H "Accept: application/json"
https://example.zendesk.com/api/v2/custom_statuses
Postman Collection Item JSON
{
"name": "List Custom Ticket Statuses",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_statuses?status_categories=<string>&active=<boolean>&default=<boolean>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_statuses"
],
"query": [
{
"key": "status_categories",
"value": "<string>",
"description": "Filter the list of custom ticket statuses by a comma-separated list of status categories"
},
{
"key": "active",
"value": "<boolean>",
"description": "If true, show only active custom ticket statuses. If false, show only inactive custom ticket statuses. If the filter is not used, show all custom ticket statuses"
},
{
"key": "default",
"value": "<boolean>",
"description": "If true, show only default custom ticket statuses. If false, show only non-default custom ticket statuses. If the filter is not used, show all custom ticket statuses"
}
]
},
"description": "Lists all undeleted custom ticket statuses for the account. No pagination is provided.\n\n#### Allowed For\n\n* End Users\n"
},
"response": [
{
"name": "List custom ticket statuses",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_statuses?status_categories=<string>&active=<boolean>&default=<boolean>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_statuses"
],
"query": [
{
"key": "status_categories",
"value": "<string>",
"description": "Filter the list of custom ticket statuses by a comma-separated list of status categories"
},
{
"key": "active",
"value": "<boolean>",
"description": "If true, show only active custom ticket statuses. If false, show only inactive custom ticket statuses. If the filter is not used, show all custom ticket statuses"
},
{
"key": "default",
"value": "<boolean>",
"description": "If true, show only default custom ticket statuses. If false, show only non-default custom ticket statuses. If the filter is not used, show all custom ticket statuses"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"custom_statuses\": [\n {\n \"status_category\": \"pending\",\n \"agent_label\": \"<string>\",\n \"active\": \"<boolean>\",\n \"created_at\": \"<dateTime>\",\n \"default\": \"<boolean>\",\n \"description\": \"<string>\",\n \"end_user_description\": \"<string>\",\n \"end_user_label\": \"<string>\",\n \"id\": \"<integer>\",\n \"raw_agent_label\": \"<string>\",\n \"raw_description\": \"<string>\",\n \"raw_end_user_description\": \"<string>\",\n \"raw_end_user_label\": \"<string>\",\n \"updated_at\": \"<dateTime>\"\n },\n {\n \"status_category\": \"hold\",\n \"agent_label\": \"<string>\",\n \"active\": \"<boolean>\",\n \"created_at\": \"<dateTime>\",\n \"default\": \"<boolean>\",\n \"description\": \"<string>\",\n \"end_user_description\": \"<string>\",\n \"end_user_label\": \"<string>\",\n \"id\": \"<integer>\",\n \"raw_agent_label\": \"<string>\",\n \"raw_description\": \"<string>\",\n \"raw_end_user_description\": \"<string>\",\n \"raw_end_user_label\": \"<string>\",\n \"updated_at\": \"<dateTime>\"\n }\n ]\n}"
}
]
}