DataFlex / Support API / Ticket Related Information
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sStrVal
String sFrom_archive
String sIncidents
String sTopic_id
Integer iDolor__1
Boolean iCommodo4b
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/tickets/:ticket_id/related" 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)
// {
// "followup_source_ids": [
// "<string>",
// "<string>"
// ],
// "from_archive": "<boolean>",
// "incidents": "<integer>",
// "topic_id": "<string>",
// "twitter": {
// "dolor__1": 77550121,
// "commodo4b": true
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComStringOf Of hoJResp "from_archive" To sFrom_archive
Get ComStringOf Of hoJResp "incidents" To sIncidents
Get ComStringOf Of hoJResp "topic_id" To sTopic_id
Get ComIntOf Of hoJResp "twitter.dolor__1" To iDolor__1
Get ComBoolOf Of hoJResp "twitter.commodo4b" To iCommodo4b
Move 0 To i
Get ComSizeOfArray Of hoJResp "followup_source_ids" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "followup_source_ids[i]" To sStrVal
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/tickets/:ticket_id/related
Postman Collection Item JSON
{
"name": "Ticket Related Information",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/tickets/:ticket_id/related",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"tickets",
":ticket_id",
"related"
],
"variable": [
{
"key": "ticket_id",
"value": "<integer>"
}
]
},
"description": "The request returns a data object with the following properties:\n\n| Name | Type | Comment\n| ------------------- | ------- | -------\n| topic_id | string | Related topic in the Web portal (deprecated feature)\n| followup_source_ids | array | Sources to follow up\n| from_archive | boolean | Is true if the current ticket is archived\n| incidents | integer | A count of related incident occurrences\n| twitter | object | Twitter information associated with the ticket\n\n#### Allowed For\n\n* Agents"
},
"response": [
{
"name": "Successful response",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/tickets/:ticket_id/related",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"tickets",
":ticket_id",
"related"
],
"variable": [
{
"key": "ticket_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"followup_source_ids\": [\n \"<string>\",\n \"<string>\"\n ],\n \"from_archive\": \"<boolean>\",\n \"incidents\": \"<integer>\",\n \"topic_id\": \"<string>\",\n \"twitter\": {\n \"dolor__1\": 77550121,\n \"commodo4b\": true\n }\n}"
}
]
}