Chilkat Online Tools

TCL / Support API / Show Workspace

Back to Collection Items

load ./chilkat.dll

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

set http [new_CkHttp]

CkHttp_put_BasicAuth $http 1
CkHttp_put_Login $http "login"
CkHttp_put_Password $http "password"

CkHttp_SetRequestHeader $http "Accept" "application/json"

set sbResponseBody [new_CkStringBuilder]

set success [CkHttp_QuickGetSb $http "https://example.zendesk.com/api/v2/workspaces/:workspace_id" $sbResponseBody]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkStringBuilder $sbResponseBody
    exit
}

set jResp [new_CkJsonObject]

CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0

puts "Response Body:"
puts [CkJsonObject_emit $jResp]

set respStatusCode [CkHttp_get_LastStatus $http]
puts "Response Status Code = $respStatusCode"
if {$respStatusCode >= 400} then {
    puts "Response Header:"
    puts [CkHttp_lastHeader $http]
    puts "Failed."
    delete_CkHttp $http
    delete_CkStringBuilder $sbResponseBody
    delete_CkJsonObject $jResp
    exit
}

# 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

set Activated [CkJsonObject_stringOf $jResp "workspace.activated"]
set Created_at [CkJsonObject_stringOf $jResp "workspace.created_at"]
set Description [CkJsonObject_stringOf $jResp "workspace.description"]
set Id [CkJsonObject_stringOf $jResp "workspace.id"]
set Position [CkJsonObject_stringOf $jResp "workspace.position"]
set Prefer_workspace_app_order [CkJsonObject_stringOf $jResp "workspace.prefer_workspace_app_order"]
set Ticket_form_id [CkJsonObject_stringOf $jResp "workspace.ticket_form_id"]
set Title [CkJsonObject_stringOf $jResp "workspace.title"]
set Updated_at [CkJsonObject_stringOf $jResp "workspace.updated_at"]
set v_Url [CkJsonObject_stringOf $jResp "workspace.url"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspace.apps"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set ad_be [CkJsonObject_BoolOf $jResp "workspace.apps[i].ad_be"]
    set ead07 [CkJsonObject_IntOf $jResp "workspace.apps[i].ead07"]
    set adipisicinga [CkJsonObject_BoolOf $jResp "workspace.apps[i].adipisicinga"]
    set fugiat_e [CkJsonObject_BoolOf $jResp "workspace.apps[i].fugiat_e"]
    set dolorf7 [CkJsonObject_stringOf $jResp "workspace.apps[i].dolorf7"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspace.conditions.all"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set field [CkJsonObject_stringOf $jResp "workspace.conditions.all[i].field"]
    set operator [CkJsonObject_stringOf $jResp "workspace.conditions.all[i].operator"]
    set value [CkJsonObject_stringOf $jResp "workspace.conditions.all[i].value"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspace.conditions.any"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set field [CkJsonObject_stringOf $jResp "workspace.conditions.any[i].field"]
    set operator [CkJsonObject_stringOf $jResp "workspace.conditions.any[i].operator"]
    set value [CkJsonObject_stringOf $jResp "workspace.conditions.any[i].value"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspace.macro_ids"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set strVal [CkJsonObject_stringOf $jResp "workspace.macro_ids[i]"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspace.macros"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set strVal [CkJsonObject_stringOf $jResp "workspace.macros[i]"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspace.selected_macros"]
while {$i < $count_i} {
    CkJsonObject_put_I $jResp $i
    set title [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].title"]
    set active [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].active"]
    set created_at [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].created_at"]
    set default [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].default"]
    set description [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].description"]
    set id [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].id"]
    set position [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].position"]
    set In_f25 [CkJsonObject_BoolOf $jResp "workspace.selected_macros[i].restriction.in_f25"]
    set Nisid81 [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].restriction.nisid81"]
    set Minim_886 [CkJsonObject_BoolOf $jResp "workspace.selected_macros[i].restriction.minim_886"]
    set updated_at [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].updated_at"]
    set url [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].url"]
    set app_installation [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].app_installation"]
    set categories [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].categories"]
    set permissions [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].permissions"]
    set usage_1h [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].usage_1h"]
    set usage_7d [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].usage_7d"]
    set usage_24h [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].usage_24h"]
    set usage_30d [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].usage_30d"]
    set Culpa__d7 [CkJsonObject_BoolOf $jResp "workspace.selected_macros[i].restriction.culpa__d7"]
    set Ad7 [CkJsonObject_BoolOf $jResp "workspace.selected_macros[i].restriction.ad7"]
    set Esse0 [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].restriction.esse0"]
    set Veniam_f [CkJsonObject_IntOf $jResp "workspace.selected_macros[i].restriction.veniam_f"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jResp "workspace.selected_macros[i].actions"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jResp $j
        set field [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].actions[j].field"]
        set value [CkJsonObject_stringOf $jResp "workspace.selected_macros[i].actions[j].value"]
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}

delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp

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