TCL / Support API / List Workspaces
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" $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)
# {
# "workspaces": [
# {
# "activated": "<boolean>",
# "apps": [
# {
# "ut_1": true
# },
# {
# "Lorem_ec": "ut ipsum nulla voluptate",
# "sed_a": 38535010.16636646
# }
# ],
# "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": {
# "elit_0": 95926683,
# "Loreme7": 1915356
# },
# "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": {
# "ut_2": true,
# "exf9": false,
# "magna_5": 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>"
# }
# ],
# "ticket_form_id": "<integer>",
# "title": "<string>",
# "updated_at": "<dateTime>",
# "url": "<string>"
# },
# {
# "activated": "<boolean>",
# "apps": [
# {
# "laborum_": "esse elit mollit nulla",
# "dolore_72": 44930495
# },
# {
# "Duis_e27": false,
# "do_7b": true,
# "eu_6": true
# }
# ],
# "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": {
# "nostrud_7": false,
# "ex69c": -43731952,
# "ut_a": "anim nostrud pariatur",
# "mollit__": -87941840
# },
# "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": {
# "deseruntc_": false,
# "consequatd0": 17786909,
# "id_4a": 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>"
# }
# ],
# "ticket_form_id": "<integer>",
# "title": "<string>",
# "updated_at": "<dateTime>",
# "url": "<string>"
# }
# ],
# "count": "<integer>",
# "next_page": "<string>",
# "previous_page": "<string>"
# }
# Sample code for parsing the JSON response...
# Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
set count [CkJsonObject_stringOf $jResp "count"]
set next_page [CkJsonObject_stringOf $jResp "next_page"]
set previous_page [CkJsonObject_stringOf $jResp "previous_page"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "workspaces"]
while {$i < $count_i} {
CkJsonObject_put_I $jResp $i
set activated [CkJsonObject_stringOf $jResp "workspaces[i].activated"]
set created_at [CkJsonObject_stringOf $jResp "workspaces[i].created_at"]
set description [CkJsonObject_stringOf $jResp "workspaces[i].description"]
set id [CkJsonObject_stringOf $jResp "workspaces[i].id"]
set position [CkJsonObject_stringOf $jResp "workspaces[i].position"]
set prefer_workspace_app_order [CkJsonObject_stringOf $jResp "workspaces[i].prefer_workspace_app_order"]
set ticket_form_id [CkJsonObject_stringOf $jResp "workspaces[i].ticket_form_id"]
set title [CkJsonObject_stringOf $jResp "workspaces[i].title"]
set updated_at [CkJsonObject_stringOf $jResp "workspaces[i].updated_at"]
set url [CkJsonObject_stringOf $jResp "workspaces[i].url"]
set j 0
set count_j [CkJsonObject_SizeOfArray $jResp "workspaces[i].apps"]
while {$j < $count_j} {
CkJsonObject_put_J $jResp $j
set ut_1 [CkJsonObject_BoolOf $jResp "workspaces[i].apps[j].ut_1"]
set Lorem_ec [CkJsonObject_stringOf $jResp "workspaces[i].apps[j].Lorem_ec"]
set sed_a [CkJsonObject_stringOf $jResp "workspaces[i].apps[j].sed_a"]
set laborum_ [CkJsonObject_stringOf $jResp "workspaces[i].apps[j].laborum_"]
set dolore_72 [CkJsonObject_IntOf $jResp "workspaces[i].apps[j].dolore_72"]
set Duis_e27 [CkJsonObject_BoolOf $jResp "workspaces[i].apps[j].Duis_e27"]
set do_7b [CkJsonObject_BoolOf $jResp "workspaces[i].apps[j].do_7b"]
set eu_6 [CkJsonObject_BoolOf $jResp "workspaces[i].apps[j].eu_6"]
set j [expr $j + 1]
}
set j 0
set count_j [CkJsonObject_SizeOfArray $jResp "workspaces[i].conditions.all"]
while {$j < $count_j} {
CkJsonObject_put_J $jResp $j
set field [CkJsonObject_stringOf $jResp "workspaces[i].conditions.all[j].field"]
set operator [CkJsonObject_stringOf $jResp "workspaces[i].conditions.all[j].operator"]
set value [CkJsonObject_stringOf $jResp "workspaces[i].conditions.all[j].value"]
set j [expr $j + 1]
}
set j 0
set count_j [CkJsonObject_SizeOfArray $jResp "workspaces[i].conditions.any"]
while {$j < $count_j} {
CkJsonObject_put_J $jResp $j
set field [CkJsonObject_stringOf $jResp "workspaces[i].conditions.any[j].field"]
set operator [CkJsonObject_stringOf $jResp "workspaces[i].conditions.any[j].operator"]
set value [CkJsonObject_stringOf $jResp "workspaces[i].conditions.any[j].value"]
set j [expr $j + 1]
}
set j 0
set count_j [CkJsonObject_SizeOfArray $jResp "workspaces[i].macro_ids"]
while {$j < $count_j} {
CkJsonObject_put_J $jResp $j
set strVal [CkJsonObject_stringOf $jResp "workspaces[i].macro_ids[j]"]
set j [expr $j + 1]
}
set j 0
set count_j [CkJsonObject_SizeOfArray $jResp "workspaces[i].macros"]
while {$j < $count_j} {
CkJsonObject_put_J $jResp $j
set strVal [CkJsonObject_stringOf $jResp "workspaces[i].macros[j]"]
set j [expr $j + 1]
}
set j 0
set count_j [CkJsonObject_SizeOfArray $jResp "workspaces[i].selected_macros"]
while {$j < $count_j} {
CkJsonObject_put_J $jResp $j
set title [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].title"]
set active [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].active"]
set created_at [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].created_at"]
set default [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].default"]
set description [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].description"]
set id [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].id"]
set position [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].position"]
set Elit_0 [CkJsonObject_IntOf $jResp "workspaces[i].selected_macros[j].restriction.elit_0"]
set Loreme7 [CkJsonObject_IntOf $jResp "workspaces[i].selected_macros[j].restriction.Loreme7"]
set updated_at [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].updated_at"]
set url [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].url"]
set app_installation [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].app_installation"]
set categories [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].categories"]
set permissions [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].permissions"]
set usage_1h [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].usage_1h"]
set usage_7d [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].usage_7d"]
set usage_24h [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].usage_24h"]
set usage_30d [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].usage_30d"]
set Ut_2 [CkJsonObject_BoolOf $jResp "workspaces[i].selected_macros[j].restriction.ut_2"]
set Exf9 [CkJsonObject_BoolOf $jResp "workspaces[i].selected_macros[j].restriction.exf9"]
set Magna_5 [CkJsonObject_BoolOf $jResp "workspaces[i].selected_macros[j].restriction.magna_5"]
set Nostrud_7 [CkJsonObject_BoolOf $jResp "workspaces[i].selected_macros[j].restriction.nostrud_7"]
set Ex69c [CkJsonObject_IntOf $jResp "workspaces[i].selected_macros[j].restriction.ex69c"]
set Ut_a [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].restriction.ut_a"]
set Mollit__ [CkJsonObject_IntOf $jResp "workspaces[i].selected_macros[j].restriction.mollit__"]
set Deseruntc_ [CkJsonObject_BoolOf $jResp "workspaces[i].selected_macros[j].restriction.deseruntc_"]
set Consequatd0 [CkJsonObject_IntOf $jResp "workspaces[i].selected_macros[j].restriction.consequatd0"]
set Id_4a [CkJsonObject_BoolOf $jResp "workspaces[i].selected_macros[j].restriction.id_4a"]
set k 0
set count_k [CkJsonObject_SizeOfArray $jResp "workspaces[i].selected_macros[j].actions"]
while {$k < $count_k} {
CkJsonObject_put_K $jResp $k
set field [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].actions[k].field"]
set value [CkJsonObject_stringOf $jResp "workspaces[i].selected_macros[j].actions[k].value"]
set k [expr $k + 1]
}
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
Postman Collection Item JSON
{
"name": "List Workspaces",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/workspaces",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"workspaces"
]
},
"description": "#### Allowed For\n\n* Admins, Agents\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/workspaces",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"workspaces"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"workspaces\": [\n {\n \"activated\": \"<boolean>\",\n \"apps\": [\n {\n \"ut_1\": true\n },\n {\n \"Lorem_ec\": \"ut ipsum nulla voluptate\",\n \"sed_a\": 38535010.16636646\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 \"elit_0\": 95926683,\n \"Loreme7\": 1915356\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 \"ut_2\": true,\n \"exf9\": false,\n \"magna_5\": 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 \"ticket_form_id\": \"<integer>\",\n \"title\": \"<string>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\"\n },\n {\n \"activated\": \"<boolean>\",\n \"apps\": [\n {\n \"laborum_\": \"esse elit mollit nulla\",\n \"dolore_72\": 44930495\n },\n {\n \"Duis_e27\": false,\n \"do_7b\": true,\n \"eu_6\": true\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 \"nostrud_7\": false,\n \"ex69c\": -43731952,\n \"ut_a\": \"anim nostrud pariatur\",\n \"mollit__\": -87941840\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 \"deseruntc_\": false,\n \"consequatd0\": 17786909,\n \"id_4a\": 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 \"ticket_form_id\": \"<integer>\",\n \"title\": \"<string>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\"\n }\n ],\n \"count\": \"<integer>\",\n \"next_page\": \"<string>\",\n \"previous_page\": \"<string>\"\n}"
}
]
}