Chilkat Online Tools

autoit / Support API / Show Many Ticket Forms

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"

$oQueryParams = ObjCreate("Chilkat.JsonObject")
$oQueryParams.UpdateString("ids","<string>")
$oQueryParams.UpdateString("active","<boolean>")
$oQueryParams.UpdateString("end_user_visible","<boolean>")
$oQueryParams.UpdateString("fallback_to_default","<boolean>")
$oQueryParams.UpdateString("associated_to_brand","<boolean>")

$oHttp.SetRequestHeader "Accept","application/json"

Local $oResp = $oHttp.QuickRequestParams("GET","https://example.zendesk.com/api/v2/ticket_forms/show_many",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)

$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oResp.Header & @CRLF)
    ConsoleWrite("Failed." & @CRLF)

    Exit
EndIf

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

; {
;   "ticket_forms": [
;     {
;       "name": "<string>",
;       "active": "<boolean>",
;       "agent_conditions": [
;         {
;           "adipisicing_648": -24086995
;         },
;         {
;           "veniamf": "cupida"
;         }
;       ],
;       "created_at": "<dateTime>",
;       "default": "<boolean>",
;       "display_name": "<string>",
;       "end_user_conditions": [
;         {
;           "in_6b8": "Ut id",
;           "magna1": -6245214
;         },
;         {
;           "pariatur1": 67097325,
;           "consectetur3": false,
;           "sed_6f0": true
;         }
;       ],
;       "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>"
;     },
;     {
;       "name": "<string>",
;       "active": "<boolean>",
;       "agent_conditions": [
;         {
;           "id9": "laborum veniam",
;           "ametb8": false
;         },
;         {
;           "ut08f": -79491980.10398532,
;           "non81": "Duis est fugiat officia consequat"
;         }
;       ],
;       "created_at": "<dateTime>",
;       "default": "<boolean>",
;       "display_name": "<string>",
;       "end_user_conditions": [
;         {
;           "sint1d2": "sint ex et"
;         },
;         {
;           "cupidatat_667": true,
;           "magna_d8": 64894285.255497575
;         }
;       ],
;       "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

Local $sName
Local $sActive
Local $sCreated_at
Local $sDefault
Local $sDisplay_name
Local $sEnd_user_visible
Local $sId
Local $sIn_all_brands
Local $sPosition
Local $sRaw_display_name
Local $sRaw_name
Local $sUpdated_at
Local $sUrl
Local $iJ
Local $iCount_j
Local $iAdipisicing_648
Local $sVeniamf
Local $sId9
Local $bAmetb8
Local $sUt08f
Local $sNon81
Local $sIn_6b8
Local $iMagna1
Local $iPariatur1
Local $bConsectetur3
Local $bSed_6f0
Local $sint1d2
Local $bCupidatat_667
Local $sMagna_d8
Local $strVal

Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("ticket_forms")
While $i < $iCount_i
    $oJResp.I = $i
    $sName = $oJResp.StringOf("ticket_forms[i].name")
    $sActive = $oJResp.StringOf("ticket_forms[i].active")
    $sCreated_at = $oJResp.StringOf("ticket_forms[i].created_at")
    $sDefault = $oJResp.StringOf("ticket_forms[i].default")
    $sDisplay_name = $oJResp.StringOf("ticket_forms[i].display_name")
    $sEnd_user_visible = $oJResp.StringOf("ticket_forms[i].end_user_visible")
    $sId = $oJResp.StringOf("ticket_forms[i].id")
    $sIn_all_brands = $oJResp.StringOf("ticket_forms[i].in_all_brands")
    $sPosition = $oJResp.StringOf("ticket_forms[i].position")
    $sRaw_display_name = $oJResp.StringOf("ticket_forms[i].raw_display_name")
    $sRaw_name = $oJResp.StringOf("ticket_forms[i].raw_name")
    $sUpdated_at = $oJResp.StringOf("ticket_forms[i].updated_at")
    $sUrl = $oJResp.StringOf("ticket_forms[i].url")
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ticket_forms[i].agent_conditions")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $iAdipisicing_648 = $oJResp.IntOf("ticket_forms[i].agent_conditions[j].adipisicing_648")
        $sVeniamf = $oJResp.StringOf("ticket_forms[i].agent_conditions[j].veniamf")
        $sId9 = $oJResp.StringOf("ticket_forms[i].agent_conditions[j].id9")
        $bAmetb8 = $oJResp.BoolOf("ticket_forms[i].agent_conditions[j].ametb8")
        $sUt08f = $oJResp.StringOf("ticket_forms[i].agent_conditions[j].ut08f")
        $sNon81 = $oJResp.StringOf("ticket_forms[i].agent_conditions[j].non81")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ticket_forms[i].end_user_conditions")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $sIn_6b8 = $oJResp.StringOf("ticket_forms[i].end_user_conditions[j].in_6b8")
        $iMagna1 = $oJResp.IntOf("ticket_forms[i].end_user_conditions[j].magna1")
        $iPariatur1 = $oJResp.IntOf("ticket_forms[i].end_user_conditions[j].pariatur1")
        $bConsectetur3 = $oJResp.BoolOf("ticket_forms[i].end_user_conditions[j].consectetur3")
        $bSed_6f0 = $oJResp.BoolOf("ticket_forms[i].end_user_conditions[j].sed_6f0")
        $sint1d2 = $oJResp.StringOf("ticket_forms[i].end_user_conditions[j].sint1d2")
        $bCupidatat_667 = $oJResp.BoolOf("ticket_forms[i].end_user_conditions[j].cupidatat_667")
        $sMagna_d8 = $oJResp.StringOf("ticket_forms[i].end_user_conditions[j].magna_d8")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ticket_forms[i].restricted_brand_ids")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("ticket_forms[i].restricted_brand_ids[j]")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJResp.SizeOfArray("ticket_forms[i].ticket_field_ids")
    While $iJ < $iCount_j
        $oJResp.J = $iJ
        $strVal = $oJResp.StringOf("ticket_forms[i].ticket_field_ids[j]")
        $iJ = $iJ + 1
    Wend
    $i = $i + 1
Wend

Curl Command

curl  -u login:password -G -d "ids=%3Cstring%3E"
	-d "active=%3Cboolean%3E"
	-d "end_user_visible=%3Cboolean%3E"
	-d "fallback_to_default=%3Cboolean%3E"
	-d "associated_to_brand=%3Cboolean%3E"
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/ticket_forms/show_many

Postman Collection Item JSON

{
  "name": "Show Many Ticket Forms",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/ticket_forms/show_many?ids=<string>&active=<boolean>&end_user_visible=<boolean>&fallback_to_default=<boolean>&associated_to_brand=<boolean>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "ticket_forms",
        "show_many"
      ],
      "query": [
        {
          "key": "ids",
          "value": "<string>",
          "description": "(Required) IDs of the ticket forms to be shown"
        },
        {
          "key": "active",
          "value": "<boolean>",
          "description": "true returns active ticket forms; false returns inactive ticket forms. If not present, returns both"
        },
        {
          "key": "end_user_visible",
          "value": "<boolean>",
          "description": "true returns ticket forms where `end_user_visible`; false returns ticket forms that are not end-user visible. If not present, returns both"
        },
        {
          "key": "fallback_to_default",
          "value": "<boolean>",
          "description": "true returns the default ticket form when the criteria defined by the parameters results in a set without active and end-user visible ticket forms"
        },
        {
          "key": "associated_to_brand",
          "value": "<boolean>",
          "description": "true returns the ticket forms of the brand specified by the url's subdomain"
        }
      ]
    },
    "description": "Takes an `ids` query parameter that accepts a comma-separated list of up to 100 ticket form ids. This endpoint is used primarily by the [mobile SDK](/documentation/classic-web-widget-sdks/) and the [Web Widget](/api-reference/widget/introduction/).\n\n#### Allowed For\n\n* Anyone\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/show_many?ids=<string>&active=<boolean>&end_user_visible=<boolean>&fallback_to_default=<boolean>&associated_to_brand=<boolean>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "ticket_forms",
            "show_many"
          ],
          "query": [
            {
              "key": "ids",
              "value": "<string>",
              "description": "(Required) IDs of the ticket forms to be shown"
            },
            {
              "key": "active",
              "value": "<boolean>",
              "description": "true returns active ticket forms; false returns inactive ticket forms. If not present, returns both"
            },
            {
              "key": "end_user_visible",
              "value": "<boolean>",
              "description": "true returns ticket forms where `end_user_visible`; false returns ticket forms that are not end-user visible. If not present, returns both"
            },
            {
              "key": "fallback_to_default",
              "value": "<boolean>",
              "description": "true returns the default ticket form when the criteria defined by the parameters results in a set without active and end-user visible ticket forms"
            },
            {
              "key": "associated_to_brand",
              "value": "<boolean>",
              "description": "true returns the ticket forms of the brand specified by the url's subdomain"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"ticket_forms\": [\n    {\n      \"name\": \"<string>\",\n      \"active\": \"<boolean>\",\n      \"agent_conditions\": [\n        {\n          \"adipisicing_648\": -24086995\n        },\n        {\n          \"veniamf\": \"cupida\"\n        }\n      ],\n      \"created_at\": \"<dateTime>\",\n      \"default\": \"<boolean>\",\n      \"display_name\": \"<string>\",\n      \"end_user_conditions\": [\n        {\n          \"in_6b8\": \"Ut id\",\n          \"magna1\": -6245214\n        },\n        {\n          \"pariatur1\": 67097325,\n          \"consectetur3\": false,\n          \"sed_6f0\": true\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    {\n      \"name\": \"<string>\",\n      \"active\": \"<boolean>\",\n      \"agent_conditions\": [\n        {\n          \"id9\": \"laborum veniam\",\n          \"ametb8\": false\n        },\n        {\n          \"ut08f\": -79491980.10398532,\n          \"non81\": \"Duis est fugiat officia consequat\"\n        }\n      ],\n      \"created_at\": \"<dateTime>\",\n      \"default\": \"<boolean>\",\n      \"display_name\": \"<string>\",\n      \"end_user_conditions\": [\n        {\n          \"sint1d2\": \"sint ex et\"\n        },\n        {\n          \"cupidatat_667\": true,\n          \"magna_d8\": 64894285.255497575\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  ]\n}"
    }
  ]
}