Chilkat Online Tools

DataFlex / Support API / Show Workspace

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    Boolean iAd_be
    Integer iEad07
    Boolean iAdipisicinga
    Boolean iFugiat_e
    String sDolorf7
    String sField
    String sOperator
    String sValue
    String sStrVal
    String sTitle
    String sActive
    String sCreated_at
    String sDefault
    String sDescription
    String sId
    String sPosition
    Boolean iIn_f25
    String sNisid81
    Boolean iMinim_886
    String sUpdated_at
    String sUrl
    String sApp_installation
    String sCategories
    String sPermissions
    String sUsage_1h
    String sUsage_7d
    String sUsage_24h
    String sUsage_30d
    Boolean iCulpa__d7
    Boolean iAd7
    String sEsse0
    Integer iVeniam_f
    Integer j
    Integer iCount_j
    String sActivated
    String sCreated_at
    String sDescription
    String sId
    String sPosition
    String sPrefer_workspace_app_order
    String sTicket_form_id
    String sTitle
    String sUpdated_at
    String sV_Url
    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/workspaces/:workspace_id" 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)

    // {
    //   "workspace": {
    //     "activated": "<boolean>",
    //     "apps": [
    //       {
    //         "ad_be": true,
    //         "ead07": 69455617,
    //         "adipisicinga": true
    //       },
    //       {
    //         "fugiat_e": false,
    //         "dolorf7": -57129708.70016649
    //       }
    //     ],
    //     "conditions": {
    //       "all": [
    //         {
    //           "field": "<string>",
    //           "operator": "<string>",
    //           "value": "<string>"
    //         },
    //         {
    //           "field": "<string>",
    //           "operator": "<string>",
    //           "value": "<string>"
    //         }
    //       ],
    //       "any": [
    //         {
    //           "field": "<string>",
    //           "operator": "<string>",
    //           "value": "<string>"
    //         },
    //         {
    //           "field": "<string>",
    //           "operator": "<string>",
    //           "value": "<string>"
    //         }
    //       ]
    //     },
    //     "created_at": "<dateTime>",
    //     "description": "<string>",
    //     "id": "<integer>",
    //     "macro_ids": [
    //       "<integer>",
    //       "<integer>"
    //     ],
    //     "macros": [
    //       "<integer>",
    //       "<integer>"
    //     ],
    //     "position": "<integer>",
    //     "prefer_workspace_app_order": "<boolean>",
    //     "selected_macros": [
    //       {
    //         "actions": [
    //           {
    //             "field": "<string>",
    //             "value": "<string>"
    //           },
    //           {
    //             "field": "<string>",
    //             "value": "<string>"
    //           }
    //         ],
    //         "title": "<string>",
    //         "active": "<boolean>",
    //         "created_at": "<dateTime>",
    //         "default": "<boolean>",
    //         "description": "<string>",
    //         "id": "<integer>",
    //         "position": "<integer>",
    //         "restriction": {
    //           "in_f25": true,
    //           "nisid81": "reprehenderit anim nostrud id",
    //           "minim_886": false
    //         },
    //         "updated_at": "<dateTime>",
    //         "url": "<string>",
    //         "app_installation": "<string>",
    //         "categories": "<string>",
    //         "permissions": "<string>",
    //         "usage_1h": "<integer>",
    //         "usage_7d": "<integer>",
    //         "usage_24h": "<integer>",
    //         "usage_30d": "<integer>"
    //       },
    //       {
    //         "actions": [
    //           {
    //             "field": "<string>",
    //             "value": "<string>"
    //           },
    //           {
    //             "field": "<string>",
    //             "value": "<string>"
    //           }
    //         ],
    //         "title": "<string>",
    //         "active": "<boolean>",
    //         "created_at": "<dateTime>",
    //         "default": "<boolean>",
    //         "description": "<string>",
    //         "id": "<integer>",
    //         "position": "<integer>",
    //         "restriction": {
    //           "culpa__d7": false,
    //           "ad7": true,
    //           "esse0": -82046233.9137964,
    //           "veniam_f": -91185504
    //         },
    //         "updated_at": "<dateTime>",
    //         "url": "<string>",
    //         "app_installation": "<string>",
    //         "categories": "<string>",
    //         "permissions": "<string>",
    //         "usage_1h": "<integer>",
    //         "usage_7d": "<integer>",
    //         "usage_24h": "<integer>",
    //         "usage_30d": "<integer>"
    //       }
    //     ],
    //     "ticket_form_id": "<integer>",
    //     "title": "<string>",
    //     "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

    Get ComStringOf Of hoJResp "workspace.activated" To sActivated
    Get ComStringOf Of hoJResp "workspace.created_at" To sCreated_at
    Get ComStringOf Of hoJResp "workspace.description" To sDescription
    Get ComStringOf Of hoJResp "workspace.id" To sId
    Get ComStringOf Of hoJResp "workspace.position" To sPosition
    Get ComStringOf Of hoJResp "workspace.prefer_workspace_app_order" To sPrefer_workspace_app_order
    Get ComStringOf Of hoJResp "workspace.ticket_form_id" To sTicket_form_id
    Get ComStringOf Of hoJResp "workspace.title" To sTitle
    Get ComStringOf Of hoJResp "workspace.updated_at" To sUpdated_at
    Get ComStringOf Of hoJResp "workspace.url" To sV_Url
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "workspace.apps" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComBoolOf Of hoJResp "workspace.apps[i].ad_be" To iAd_be
        Get ComIntOf Of hoJResp "workspace.apps[i].ead07" To iEad07
        Get ComBoolOf Of hoJResp "workspace.apps[i].adipisicinga" To iAdipisicinga
        Get ComBoolOf Of hoJResp "workspace.apps[i].fugiat_e" To iFugiat_e
        Get ComStringOf Of hoJResp "workspace.apps[i].dolorf7" To sDolorf7
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "workspace.conditions.all" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "workspace.conditions.all[i].field" To sField
        Get ComStringOf Of hoJResp "workspace.conditions.all[i].operator" To sOperator
        Get ComStringOf Of hoJResp "workspace.conditions.all[i].value" To sValue
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "workspace.conditions.any" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "workspace.conditions.any[i].field" To sField
        Get ComStringOf Of hoJResp "workspace.conditions.any[i].operator" To sOperator
        Get ComStringOf Of hoJResp "workspace.conditions.any[i].value" To sValue
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "workspace.macro_ids" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "workspace.macro_ids[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "workspace.macros" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "workspace.macros[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "workspace.selected_macros" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].title" To sTitle
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].active" To sActive
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].created_at" To sCreated_at
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].default" To sDefault
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].description" To sDescription
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].id" To sId
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].position" To sPosition
        Get ComBoolOf Of hoJResp "workspace.selected_macros[i].restriction.in_f25" To iIn_f25
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].restriction.nisid81" To sNisid81
        Get ComBoolOf Of hoJResp "workspace.selected_macros[i].restriction.minim_886" To iMinim_886
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].updated_at" To sUpdated_at
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].url" To sUrl
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].app_installation" To sApp_installation
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].categories" To sCategories
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].permissions" To sPermissions
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].usage_1h" To sUsage_1h
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].usage_7d" To sUsage_7d
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].usage_24h" To sUsage_24h
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].usage_30d" To sUsage_30d
        Get ComBoolOf Of hoJResp "workspace.selected_macros[i].restriction.culpa__d7" To iCulpa__d7
        Get ComBoolOf Of hoJResp "workspace.selected_macros[i].restriction.ad7" To iAd7
        Get ComStringOf Of hoJResp "workspace.selected_macros[i].restriction.esse0" To sEsse0
        Get ComIntOf Of hoJResp "workspace.selected_macros[i].restriction.veniam_f" To iVeniam_f
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "workspace.selected_macros[i].actions" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "workspace.selected_macros[i].actions[j].field" To sField
            Get ComStringOf Of hoJResp "workspace.selected_macros[i].actions[j].value" To sValue
            Move (j + 1) To j
        Loop

        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/workspaces/:workspace_id

Postman Collection Item JSON

{
  "name": "Show Workspace",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/workspaces/:workspace_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "workspaces",
        ":workspace_id"
      ],
      "variable": [
        {
          "key": "workspace_id",
          "value": "<integer>"
        }
      ]
    },
    "description": "#### Allowed For\n* Admins\n"
  },
  "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/workspaces/:workspace_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "workspaces",
            ":workspace_id"
          ],
          "variable": [
            {
              "key": "workspace_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"workspace\": {\n    \"activated\": \"<boolean>\",\n    \"apps\": [\n      {\n        \"ad_be\": true,\n        \"ead07\": 69455617,\n        \"adipisicinga\": true\n      },\n      {\n        \"fugiat_e\": false,\n        \"dolorf7\": -57129708.70016649\n      }\n    ],\n    \"conditions\": {\n      \"all\": [\n        {\n          \"field\": \"<string>\",\n          \"operator\": \"<string>\",\n          \"value\": \"<string>\"\n        },\n        {\n          \"field\": \"<string>\",\n          \"operator\": \"<string>\",\n          \"value\": \"<string>\"\n        }\n      ],\n      \"any\": [\n        {\n          \"field\": \"<string>\",\n          \"operator\": \"<string>\",\n          \"value\": \"<string>\"\n        },\n        {\n          \"field\": \"<string>\",\n          \"operator\": \"<string>\",\n          \"value\": \"<string>\"\n        }\n      ]\n    },\n    \"created_at\": \"<dateTime>\",\n    \"description\": \"<string>\",\n    \"id\": \"<integer>\",\n    \"macro_ids\": [\n      \"<integer>\",\n      \"<integer>\"\n    ],\n    \"macros\": [\n      \"<integer>\",\n      \"<integer>\"\n    ],\n    \"position\": \"<integer>\",\n    \"prefer_workspace_app_order\": \"<boolean>\",\n    \"selected_macros\": [\n      {\n        \"actions\": [\n          {\n            \"field\": \"<string>\",\n            \"value\": \"<string>\"\n          },\n          {\n            \"field\": \"<string>\",\n            \"value\": \"<string>\"\n          }\n        ],\n        \"title\": \"<string>\",\n        \"active\": \"<boolean>\",\n        \"created_at\": \"<dateTime>\",\n        \"default\": \"<boolean>\",\n        \"description\": \"<string>\",\n        \"id\": \"<integer>\",\n        \"position\": \"<integer>\",\n        \"restriction\": {\n          \"in_f25\": true,\n          \"nisid81\": \"reprehenderit anim nostrud id\",\n          \"minim_886\": false\n        },\n        \"updated_at\": \"<dateTime>\",\n        \"url\": \"<string>\",\n        \"app_installation\": \"<string>\",\n        \"categories\": \"<string>\",\n        \"permissions\": \"<string>\",\n        \"usage_1h\": \"<integer>\",\n        \"usage_7d\": \"<integer>\",\n        \"usage_24h\": \"<integer>\",\n        \"usage_30d\": \"<integer>\"\n      },\n      {\n        \"actions\": [\n          {\n            \"field\": \"<string>\",\n            \"value\": \"<string>\"\n          },\n          {\n            \"field\": \"<string>\",\n            \"value\": \"<string>\"\n          }\n        ],\n        \"title\": \"<string>\",\n        \"active\": \"<boolean>\",\n        \"created_at\": \"<dateTime>\",\n        \"default\": \"<boolean>\",\n        \"description\": \"<string>\",\n        \"id\": \"<integer>\",\n        \"position\": \"<integer>\",\n        \"restriction\": {\n          \"culpa__d7\": false,\n          \"ad7\": true,\n          \"esse0\": -82046233.9137964,\n          \"veniam_f\": -91185504\n        },\n        \"updated_at\": \"<dateTime>\",\n        \"url\": \"<string>\",\n        \"app_installation\": \"<string>\",\n        \"categories\": \"<string>\",\n        \"permissions\": \"<string>\",\n        \"usage_1h\": \"<integer>\",\n        \"usage_7d\": \"<integer>\",\n        \"usage_24h\": \"<integer>\",\n        \"usage_30d\": \"<integer>\"\n      }\n    ],\n    \"ticket_form_id\": \"<integer>\",\n    \"title\": \"<string>\",\n    \"updated_at\": \"<dateTime>\",\n    \"url\": \"<string>\"\n  }\n}"
    }
  ]
}