Chilkat Online Tools

Foxpro / Support API / Reorder Ticket Forms

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcName
LOCAL lcActive
LOCAL lcCreated_at
LOCAL lcDefault
LOCAL lcDisplay_name
LOCAL lcEnd_user_visible
LOCAL lcId
LOCAL lcIn_all_brands
LOCAL lcPosition
LOCAL lcRaw_display_name
LOCAL lcRaw_name
LOCAL lcUpdated_at
LOCAL lcUrl
LOCAL j
LOCAL lnCount_j
LOCAL lnAdipisicing_648
LOCAL lcVeniamf
LOCAL lcId9
LOCAL lnAmetb8
LOCAL lcUt08f
LOCAL lcNon81
LOCAL lcIn_6b8
LOCAL lnMagna1
LOCAL lnPariatur1
LOCAL lnConsectetur3
LOCAL lnSed_6f0
LOCAL lcSint1d2
LOCAL lnCupidatat_667
LOCAL lcMagna_d8
LOCAL lcStrVal
LOCAL i
LOCAL lnCount_i

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

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

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

loResp = loHttp.QuickRequest("PUT","https://example.zendesk.com/api/v2/ticket_forms/reorder")
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loResp.Header
    ? "Failed."
    RELEASE loResp
    RELEASE loHttp
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

RELEASE loResp

* 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

i = 0
lnCount_i = loJResp.SizeOfArray("ticket_forms")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcName = loJResp.StringOf("ticket_forms[i].name")
    lcActive = loJResp.StringOf("ticket_forms[i].active")
    lcCreated_at = loJResp.StringOf("ticket_forms[i].created_at")
    lcDefault = loJResp.StringOf("ticket_forms[i].default")
    lcDisplay_name = loJResp.StringOf("ticket_forms[i].display_name")
    lcEnd_user_visible = loJResp.StringOf("ticket_forms[i].end_user_visible")
    lcId = loJResp.StringOf("ticket_forms[i].id")
    lcIn_all_brands = loJResp.StringOf("ticket_forms[i].in_all_brands")
    lcPosition = loJResp.StringOf("ticket_forms[i].position")
    lcRaw_display_name = loJResp.StringOf("ticket_forms[i].raw_display_name")
    lcRaw_name = loJResp.StringOf("ticket_forms[i].raw_name")
    lcUpdated_at = loJResp.StringOf("ticket_forms[i].updated_at")
    lcUrl = loJResp.StringOf("ticket_forms[i].url")
    j = 0
    lnCount_j = loJResp.SizeOfArray("ticket_forms[i].agent_conditions")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lnAdipisicing_648 = loJResp.IntOf("ticket_forms[i].agent_conditions[j].adipisicing_648")
        lcVeniamf = loJResp.StringOf("ticket_forms[i].agent_conditions[j].veniamf")
        lcId9 = loJResp.StringOf("ticket_forms[i].agent_conditions[j].id9")
        lnAmetb8 = loJResp.BoolOf("ticket_forms[i].agent_conditions[j].ametb8")
        lcUt08f = loJResp.StringOf("ticket_forms[i].agent_conditions[j].ut08f")
        lcNon81 = loJResp.StringOf("ticket_forms[i].agent_conditions[j].non81")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("ticket_forms[i].end_user_conditions")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcIn_6b8 = loJResp.StringOf("ticket_forms[i].end_user_conditions[j].in_6b8")
        lnMagna1 = loJResp.IntOf("ticket_forms[i].end_user_conditions[j].magna1")
        lnPariatur1 = loJResp.IntOf("ticket_forms[i].end_user_conditions[j].pariatur1")
        lnConsectetur3 = loJResp.BoolOf("ticket_forms[i].end_user_conditions[j].consectetur3")
        lnSed_6f0 = loJResp.BoolOf("ticket_forms[i].end_user_conditions[j].sed_6f0")
        lcSint1d2 = loJResp.StringOf("ticket_forms[i].end_user_conditions[j].sint1d2")
        lnCupidatat_667 = loJResp.BoolOf("ticket_forms[i].end_user_conditions[j].cupidatat_667")
        lcMagna_d8 = loJResp.StringOf("ticket_forms[i].end_user_conditions[j].magna_d8")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("ticket_forms[i].restricted_brand_ids")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("ticket_forms[i].restricted_brand_ids[j]")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJResp.SizeOfArray("ticket_forms[i].ticket_field_ids")
    DO WHILE j < lnCount_j
        loJResp.J = j
        lcStrVal = loJResp.StringOf("ticket_forms[i].ticket_field_ids[j]")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp

Curl Command

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

Postman Collection Item JSON

{
  "name": "Reorder Ticket Forms",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/ticket_forms/reorder",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "ticket_forms",
        "reorder"
      ]
    },
    "description": "#### Allowed For\n* Admins\n\n#### Request Parameters\n\nYou can pass in the following parameter in the payload:\n\n| Name                | Type   | Comment\n| ------------------- | ------ | --------\n| ticket_form_ids     | array  | An array of ticket form ids. Example: \"[2, 23, 46, 50]\"\n"
  },
  "response": [
    {
      "name": "Success response",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/v2/ticket_forms/reorder",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "ticket_forms",
            "reorder"
          ]
        }
      },
      "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}"
    }
  ]
}