Chilkat Online Tools

DataFlex / Support API / Reorder Ticket Forms

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sName
    String sActive
    String sCreated_at
    String sDefault
    String sDisplay_name
    String sEnd_user_visible
    String sId
    String sIn_all_brands
    String sPosition
    String sRaw_display_name
    String sRaw_name
    String sUpdated_at
    String sUrl
    Integer j
    Integer iCount_j
    Integer iAdipisicing_648
    String sVeniamf
    String sId9
    Boolean iAmetb8
    String sUt08f
    String sNon81
    String sIn_6b8
    Integer iMagna1
    Integer iPariatur1
    Boolean iConsectetur3
    Boolean iSed_6f0
    String sSint1d2
    Boolean iCupidatat_667
    String sMagna_d8
    String sStrVal
    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"

    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get ComQuickRequest Of hoHttp "PUT" "https://example.zendesk.com/api/v2/ticket_forms/reorder" 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)

    // {
    //   "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

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "ticket_forms" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "ticket_forms[i].name" To sName
        Get ComStringOf Of hoJResp "ticket_forms[i].active" To sActive
        Get ComStringOf Of hoJResp "ticket_forms[i].created_at" To sCreated_at
        Get ComStringOf Of hoJResp "ticket_forms[i].default" To sDefault
        Get ComStringOf Of hoJResp "ticket_forms[i].display_name" To sDisplay_name
        Get ComStringOf Of hoJResp "ticket_forms[i].end_user_visible" To sEnd_user_visible
        Get ComStringOf Of hoJResp "ticket_forms[i].id" To sId
        Get ComStringOf Of hoJResp "ticket_forms[i].in_all_brands" To sIn_all_brands
        Get ComStringOf Of hoJResp "ticket_forms[i].position" To sPosition
        Get ComStringOf Of hoJResp "ticket_forms[i].raw_display_name" To sRaw_display_name
        Get ComStringOf Of hoJResp "ticket_forms[i].raw_name" To sRaw_name
        Get ComStringOf Of hoJResp "ticket_forms[i].updated_at" To sUpdated_at
        Get ComStringOf Of hoJResp "ticket_forms[i].url" To sUrl
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "ticket_forms[i].agent_conditions" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComIntOf Of hoJResp "ticket_forms[i].agent_conditions[j].adipisicing_648" To iAdipisicing_648
            Get ComStringOf Of hoJResp "ticket_forms[i].agent_conditions[j].veniamf" To sVeniamf
            Get ComStringOf Of hoJResp "ticket_forms[i].agent_conditions[j].id9" To sId9
            Get ComBoolOf Of hoJResp "ticket_forms[i].agent_conditions[j].ametb8" To iAmetb8
            Get ComStringOf Of hoJResp "ticket_forms[i].agent_conditions[j].ut08f" To sUt08f
            Get ComStringOf Of hoJResp "ticket_forms[i].agent_conditions[j].non81" To sNon81
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "ticket_forms[i].end_user_conditions" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "ticket_forms[i].end_user_conditions[j].in_6b8" To sIn_6b8
            Get ComIntOf Of hoJResp "ticket_forms[i].end_user_conditions[j].magna1" To iMagna1
            Get ComIntOf Of hoJResp "ticket_forms[i].end_user_conditions[j].pariatur1" To iPariatur1
            Get ComBoolOf Of hoJResp "ticket_forms[i].end_user_conditions[j].consectetur3" To iConsectetur3
            Get ComBoolOf Of hoJResp "ticket_forms[i].end_user_conditions[j].sed_6f0" To iSed_6f0
            Get ComStringOf Of hoJResp "ticket_forms[i].end_user_conditions[j].sint1d2" To sSint1d2
            Get ComBoolOf Of hoJResp "ticket_forms[i].end_user_conditions[j].cupidatat_667" To iCupidatat_667
            Get ComStringOf Of hoJResp "ticket_forms[i].end_user_conditions[j].magna_d8" To sMagna_d8
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "ticket_forms[i].restricted_brand_ids" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "ticket_forms[i].restricted_brand_ids[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "ticket_forms[i].ticket_field_ids" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "ticket_forms[i].ticket_field_ids[j]" To sStrVal
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop



End_Procedure

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}"
    }
  ]
}