Chilkat Online Tools

PowerBuilder / Support API / Show Ticket Form

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Aliqua6
string ls_Lorem_d
integer li_Mollit_cf
string ls_Ullamco_f7
string ls_Consequate_
integer li_Consectetur_00
string ls_Laborum50
integer li_Irure__c
string ls_Excepteur_38
string ls_Sunt_8
string ls_Nulla_48
string ls_Ullamco_f6
string ls_StrVal
string ls_Name
string ls_Active
string ls_Created_at
string ls_Default
string ls_Display_name
string ls_End_user_visible
string ls_Id
string ls_In_all_brands
string ls_Position
string ls_Raw_display_name
string ls_Raw_name
string ls_Updated_at
string ls_V_Url
integer i
integer li_Count_i

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"

loo_Http.SetRequestHeader("Accept","application/json")

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/ticket_forms/:ticket_form_id",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "ticket_form": {
//     "name": "<string>",
//     "active": "<boolean>",
//     "agent_conditions": [
//       {
//         "aliqua6": "proident deserunt",
//         "Lorem_d": "cillum dolor Excepteur ut",
//         "mollit_cf": -33059877,
//         "ullamco_f7": "dolore occaeca"
//       },
//       {
//         "consequate_": 29214347.18513973,
//         "consectetur_00": 83697330,
//         "laborum50": "cillum Ut"
//       }
//     ],
//     "created_at": "<dateTime>",
//     "default": "<boolean>",
//     "display_name": "<string>",
//     "end_user_conditions": [
//       {
//         "irure__c": false,
//         "Excepteur_38": -15203265.607602075,
//         "sunt_8": "culpa laboris Ut"
//       },
//       {
//         "nulla_48": "quis esse",
//         "ullamco_f6": -25516091.19614251
//       }
//     ],
//     "end_user_visible": "<boolean>",
//     "id": "<integer>",
//     "in_all_brands": "<boolean>",
//     "position": "<integer>",
//     "raw_display_name": "<string>",
//     "raw_name": "<string>",
//     "restricted_brand_ids": [
//       "<integer>",
//       "<integer>"
//     ],
//     "ticket_field_ids": [
//       "<integer>",
//       "<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

ls_Name = loo_JResp.StringOf("ticket_form.name")
ls_Active = loo_JResp.StringOf("ticket_form.active")
ls_Created_at = loo_JResp.StringOf("ticket_form.created_at")
ls_Default = loo_JResp.StringOf("ticket_form.default")
ls_Display_name = loo_JResp.StringOf("ticket_form.display_name")
ls_End_user_visible = loo_JResp.StringOf("ticket_form.end_user_visible")
ls_Id = loo_JResp.StringOf("ticket_form.id")
ls_In_all_brands = loo_JResp.StringOf("ticket_form.in_all_brands")
ls_Position = loo_JResp.StringOf("ticket_form.position")
ls_Raw_display_name = loo_JResp.StringOf("ticket_form.raw_display_name")
ls_Raw_name = loo_JResp.StringOf("ticket_form.raw_name")
ls_Updated_at = loo_JResp.StringOf("ticket_form.updated_at")
ls_V_Url = loo_JResp.StringOf("ticket_form.url")
i = 0
li_Count_i = loo_JResp.SizeOfArray("ticket_form.agent_conditions")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Aliqua6 = loo_JResp.StringOf("ticket_form.agent_conditions[i].aliqua6")
    ls_Lorem_d = loo_JResp.StringOf("ticket_form.agent_conditions[i].Lorem_d")
    li_Mollit_cf = loo_JResp.IntOf("ticket_form.agent_conditions[i].mollit_cf")
    ls_Ullamco_f7 = loo_JResp.StringOf("ticket_form.agent_conditions[i].ullamco_f7")
    ls_Consequate_ = loo_JResp.StringOf("ticket_form.agent_conditions[i].consequate_")
    li_Consectetur_00 = loo_JResp.IntOf("ticket_form.agent_conditions[i].consectetur_00")
    ls_Laborum50 = loo_JResp.StringOf("ticket_form.agent_conditions[i].laborum50")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("ticket_form.end_user_conditions")
do while i < li_Count_i
    loo_JResp.I = i
    li_Irure__c = loo_JResp.BoolOf("ticket_form.end_user_conditions[i].irure__c")
    ls_Excepteur_38 = loo_JResp.StringOf("ticket_form.end_user_conditions[i].Excepteur_38")
    ls_Sunt_8 = loo_JResp.StringOf("ticket_form.end_user_conditions[i].sunt_8")
    ls_Nulla_48 = loo_JResp.StringOf("ticket_form.end_user_conditions[i].nulla_48")
    ls_Ullamco_f6 = loo_JResp.StringOf("ticket_form.end_user_conditions[i].ullamco_f6")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("ticket_form.restricted_brand_ids")
do while i < li_Count_i
    loo_JResp.I = i
    ls_StrVal = loo_JResp.StringOf("ticket_form.restricted_brand_ids[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("ticket_form.ticket_field_ids")
do while i < li_Count_i
    loo_JResp.I = i
    ls_StrVal = loo_JResp.StringOf("ticket_form.ticket_field_ids[i]")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl  -u login:password -X GET
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/ticket_forms/:ticket_form_id

Postman Collection Item JSON

{
  "name": "Show Ticket Form",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/ticket_forms/:ticket_form_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "ticket_forms",
        ":ticket_form_id"
      ],
      "variable": [
        {
          "key": "ticket_form_id",
          "value": "<integer>"
        }
      ]
    },
    "description": "#### Allowed For\n\n* Admins, Agents, and End Users\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_forms/:ticket_form_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "ticket_forms",
            ":ticket_form_id"
          ],
          "variable": [
            {
              "key": "ticket_form_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"ticket_form\": {\n    \"name\": \"<string>\",\n    \"active\": \"<boolean>\",\n    \"agent_conditions\": [\n      {\n        \"aliqua6\": \"proident deserunt\",\n        \"Lorem_d\": \"cillum dolor Excepteur ut\",\n        \"mollit_cf\": -33059877,\n        \"ullamco_f7\": \"dolore occaeca\"\n      },\n      {\n        \"consequate_\": 29214347.18513973,\n        \"consectetur_00\": 83697330,\n        \"laborum50\": \"cillum Ut\"\n      }\n    ],\n    \"created_at\": \"<dateTime>\",\n    \"default\": \"<boolean>\",\n    \"display_name\": \"<string>\",\n    \"end_user_conditions\": [\n      {\n        \"irure__c\": false,\n        \"Excepteur_38\": -15203265.607602075,\n        \"sunt_8\": \"culpa laboris Ut\"\n      },\n      {\n        \"nulla_48\": \"quis esse\",\n        \"ullamco_f6\": -25516091.19614251\n      }\n    ],\n    \"end_user_visible\": \"<boolean>\",\n    \"id\": \"<integer>\",\n    \"in_all_brands\": \"<boolean>\",\n    \"position\": \"<integer>\",\n    \"raw_display_name\": \"<string>\",\n    \"raw_name\": \"<string>\",\n    \"restricted_brand_ids\": [\n      \"<integer>\",\n      \"<integer>\"\n    ],\n    \"ticket_field_ids\": [\n      \"<integer>\",\n      \"<integer>\"\n    ],\n    \"updated_at\": \"<dateTime>\",\n    \"url\": \"<string>\"\n  }\n}"
    }
  ]
}