PowerBuilder / Support API / List Workspaces
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Activated
string ls_Created_at
string ls_Description
string ls_Id
string ls_Position
string ls_Prefer_workspace_app_order
string ls_Ticket_form_id
string ls_Title
string ls_Updated_at
string ls_Url
integer j
integer li_Count_j
integer li_Ut_1
string ls_Lorem_ec
string ls_Sed_a
string ls_Laborum_
integer li_Dolore_72
integer li_Duis_e27
integer li_Do_7b
integer li_Eu_6
string ls_Field
string ls_Operator
string ls_Value
string ls_StrVal
string ls_Active
string ls_Default
integer li_Elit_0
integer li_Loreme7
string ls_App_installation
string ls_Categories
string ls_Permissions
string ls_Usage_1h
string ls_Usage_7d
string ls_Usage_24h
string ls_Usage_30d
integer li_Ut_2
integer li_Exf9
integer li_Magna_5
integer li_Nostrud_7
integer li_Ex69c
string ls_Ut_a
integer li_Mollit__
integer li_Deseruntc_
integer li_Consequatd0
integer li_Id_4a
integer k
integer li_Count_k
string ls_Count
string ls_Next_page
string ls_Previous_page
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"
loo_Http.SetRequestHeader("Accept","application/json")
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/workspaces",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Http.LastHeader
Write-Debug "Failed."
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
// 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
ls_Count = loo_JResp.StringOf("count")
ls_Next_page = loo_JResp.StringOf("next_page")
ls_Previous_page = loo_JResp.StringOf("previous_page")
i = 0
li_Count_i = loo_JResp.SizeOfArray("workspaces")
do while i < li_Count_i
loo_JResp.I = i
ls_Activated = loo_JResp.StringOf("workspaces[i].activated")
ls_Created_at = loo_JResp.StringOf("workspaces[i].created_at")
ls_Description = loo_JResp.StringOf("workspaces[i].description")
ls_Id = loo_JResp.StringOf("workspaces[i].id")
ls_Position = loo_JResp.StringOf("workspaces[i].position")
ls_Prefer_workspace_app_order = loo_JResp.StringOf("workspaces[i].prefer_workspace_app_order")
ls_Ticket_form_id = loo_JResp.StringOf("workspaces[i].ticket_form_id")
ls_Title = loo_JResp.StringOf("workspaces[i].title")
ls_Updated_at = loo_JResp.StringOf("workspaces[i].updated_at")
ls_Url = loo_JResp.StringOf("workspaces[i].url")
j = 0
li_Count_j = loo_JResp.SizeOfArray("workspaces[i].apps")
do while j < li_Count_j
loo_JResp.J = j
li_Ut_1 = loo_JResp.BoolOf("workspaces[i].apps[j].ut_1")
ls_Lorem_ec = loo_JResp.StringOf("workspaces[i].apps[j].Lorem_ec")
ls_Sed_a = loo_JResp.StringOf("workspaces[i].apps[j].sed_a")
ls_Laborum_ = loo_JResp.StringOf("workspaces[i].apps[j].laborum_")
li_Dolore_72 = loo_JResp.IntOf("workspaces[i].apps[j].dolore_72")
li_Duis_e27 = loo_JResp.BoolOf("workspaces[i].apps[j].Duis_e27")
li_Do_7b = loo_JResp.BoolOf("workspaces[i].apps[j].do_7b")
li_Eu_6 = loo_JResp.BoolOf("workspaces[i].apps[j].eu_6")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("workspaces[i].conditions.all")
do while j < li_Count_j
loo_JResp.J = j
ls_Field = loo_JResp.StringOf("workspaces[i].conditions.all[j].field")
ls_Operator = loo_JResp.StringOf("workspaces[i].conditions.all[j].operator")
ls_Value = loo_JResp.StringOf("workspaces[i].conditions.all[j].value")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("workspaces[i].conditions.any")
do while j < li_Count_j
loo_JResp.J = j
ls_Field = loo_JResp.StringOf("workspaces[i].conditions.any[j].field")
ls_Operator = loo_JResp.StringOf("workspaces[i].conditions.any[j].operator")
ls_Value = loo_JResp.StringOf("workspaces[i].conditions.any[j].value")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("workspaces[i].macro_ids")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("workspaces[i].macro_ids[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("workspaces[i].macros")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("workspaces[i].macros[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("workspaces[i].selected_macros")
do while j < li_Count_j
loo_JResp.J = j
ls_Title = loo_JResp.StringOf("workspaces[i].selected_macros[j].title")
ls_Active = loo_JResp.StringOf("workspaces[i].selected_macros[j].active")
ls_Created_at = loo_JResp.StringOf("workspaces[i].selected_macros[j].created_at")
ls_Default = loo_JResp.StringOf("workspaces[i].selected_macros[j].default")
ls_Description = loo_JResp.StringOf("workspaces[i].selected_macros[j].description")
ls_Id = loo_JResp.StringOf("workspaces[i].selected_macros[j].id")
ls_Position = loo_JResp.StringOf("workspaces[i].selected_macros[j].position")
li_Elit_0 = loo_JResp.IntOf("workspaces[i].selected_macros[j].restriction.elit_0")
li_Loreme7 = loo_JResp.IntOf("workspaces[i].selected_macros[j].restriction.Loreme7")
ls_Updated_at = loo_JResp.StringOf("workspaces[i].selected_macros[j].updated_at")
ls_Url = loo_JResp.StringOf("workspaces[i].selected_macros[j].url")
ls_App_installation = loo_JResp.StringOf("workspaces[i].selected_macros[j].app_installation")
ls_Categories = loo_JResp.StringOf("workspaces[i].selected_macros[j].categories")
ls_Permissions = loo_JResp.StringOf("workspaces[i].selected_macros[j].permissions")
ls_Usage_1h = loo_JResp.StringOf("workspaces[i].selected_macros[j].usage_1h")
ls_Usage_7d = loo_JResp.StringOf("workspaces[i].selected_macros[j].usage_7d")
ls_Usage_24h = loo_JResp.StringOf("workspaces[i].selected_macros[j].usage_24h")
ls_Usage_30d = loo_JResp.StringOf("workspaces[i].selected_macros[j].usage_30d")
li_Ut_2 = loo_JResp.BoolOf("workspaces[i].selected_macros[j].restriction.ut_2")
li_Exf9 = loo_JResp.BoolOf("workspaces[i].selected_macros[j].restriction.exf9")
li_Magna_5 = loo_JResp.BoolOf("workspaces[i].selected_macros[j].restriction.magna_5")
li_Nostrud_7 = loo_JResp.BoolOf("workspaces[i].selected_macros[j].restriction.nostrud_7")
li_Ex69c = loo_JResp.IntOf("workspaces[i].selected_macros[j].restriction.ex69c")
ls_Ut_a = loo_JResp.StringOf("workspaces[i].selected_macros[j].restriction.ut_a")
li_Mollit__ = loo_JResp.IntOf("workspaces[i].selected_macros[j].restriction.mollit__")
li_Deseruntc_ = loo_JResp.BoolOf("workspaces[i].selected_macros[j].restriction.deseruntc_")
li_Consequatd0 = loo_JResp.IntOf("workspaces[i].selected_macros[j].restriction.consequatd0")
li_Id_4a = loo_JResp.BoolOf("workspaces[i].selected_macros[j].restriction.id_4a")
k = 0
li_Count_k = loo_JResp.SizeOfArray("workspaces[i].selected_macros[j].actions")
do while k < li_Count_k
loo_JResp.K = k
ls_Field = loo_JResp.StringOf("workspaces[i].selected_macros[j].actions[k].field")
ls_Value = loo_JResp.StringOf("workspaces[i].selected_macros[j].actions[k].value")
k = k + 1
loop
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_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}"
}
]
}