Foxpro / Support API / List Workspaces
Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcActivated
LOCAL lcCreated_at
LOCAL lcDescription
LOCAL lcId
LOCAL lcPosition
LOCAL lcPrefer_workspace_app_order
LOCAL lcTicket_form_id
LOCAL lcTitle
LOCAL lcUpdated_at
LOCAL lcUrl
LOCAL j
LOCAL lnCount_j
LOCAL lnUt_1
LOCAL lcLorem_ec
LOCAL lcSed_a
LOCAL lcLaborum_
LOCAL lnDolore_72
LOCAL lnDuis_e27
LOCAL lnDo_7b
LOCAL lnEu_6
LOCAL lcField
LOCAL lcOperator
LOCAL lcValue
LOCAL lcStrVal
LOCAL lcActive
LOCAL lcDefault
LOCAL lnElit_0
LOCAL lnLoreme7
LOCAL lcApp_installation
LOCAL lcCategories
LOCAL lcPermissions
LOCAL lcUsage_1h
LOCAL lcUsage_7d
LOCAL lcUsage_24h
LOCAL lcUsage_30d
LOCAL lnUt_2
LOCAL lnExf9
LOCAL lnMagna_5
LOCAL lnNostrud_7
LOCAL lnEx69c
LOCAL lcUt_a
LOCAL lnMollit__
LOCAL lnDeseruntc_
LOCAL lnConsequatd0
LOCAL lnId_4a
LOCAL k
LOCAL lnCount_k
LOCAL lcCount
LOCAL lcNext_page
LOCAL lcPrevious_page
LOCAL i
LOCAL lnCount_i
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
loHttp.BasicAuth = 1
loHttp.Login = "login"
loHttp.Password = "password"
loHttp.SetRequestHeader("Accept","application/json")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://example.zendesk.com/api/v2/workspaces",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* 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
lcCount = loJResp.StringOf("count")
lcNext_page = loJResp.StringOf("next_page")
lcPrevious_page = loJResp.StringOf("previous_page")
i = 0
lnCount_i = loJResp.SizeOfArray("workspaces")
DO WHILE i < lnCount_i
loJResp.I = i
lcActivated = loJResp.StringOf("workspaces[i].activated")
lcCreated_at = loJResp.StringOf("workspaces[i].created_at")
lcDescription = loJResp.StringOf("workspaces[i].description")
lcId = loJResp.StringOf("workspaces[i].id")
lcPosition = loJResp.StringOf("workspaces[i].position")
lcPrefer_workspace_app_order = loJResp.StringOf("workspaces[i].prefer_workspace_app_order")
lcTicket_form_id = loJResp.StringOf("workspaces[i].ticket_form_id")
lcTitle = loJResp.StringOf("workspaces[i].title")
lcUpdated_at = loJResp.StringOf("workspaces[i].updated_at")
lcUrl = loJResp.StringOf("workspaces[i].url")
j = 0
lnCount_j = loJResp.SizeOfArray("workspaces[i].apps")
DO WHILE j < lnCount_j
loJResp.J = j
lnUt_1 = loJResp.BoolOf("workspaces[i].apps[j].ut_1")
lcLorem_ec = loJResp.StringOf("workspaces[i].apps[j].Lorem_ec")
lcSed_a = loJResp.StringOf("workspaces[i].apps[j].sed_a")
lcLaborum_ = loJResp.StringOf("workspaces[i].apps[j].laborum_")
lnDolore_72 = loJResp.IntOf("workspaces[i].apps[j].dolore_72")
lnDuis_e27 = loJResp.BoolOf("workspaces[i].apps[j].Duis_e27")
lnDo_7b = loJResp.BoolOf("workspaces[i].apps[j].do_7b")
lnEu_6 = loJResp.BoolOf("workspaces[i].apps[j].eu_6")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("workspaces[i].conditions.all")
DO WHILE j < lnCount_j
loJResp.J = j
lcField = loJResp.StringOf("workspaces[i].conditions.all[j].field")
lcOperator = loJResp.StringOf("workspaces[i].conditions.all[j].operator")
lcValue = loJResp.StringOf("workspaces[i].conditions.all[j].value")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("workspaces[i].conditions.any")
DO WHILE j < lnCount_j
loJResp.J = j
lcField = loJResp.StringOf("workspaces[i].conditions.any[j].field")
lcOperator = loJResp.StringOf("workspaces[i].conditions.any[j].operator")
lcValue = loJResp.StringOf("workspaces[i].conditions.any[j].value")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("workspaces[i].macro_ids")
DO WHILE j < lnCount_j
loJResp.J = j
lcStrVal = loJResp.StringOf("workspaces[i].macro_ids[j]")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("workspaces[i].macros")
DO WHILE j < lnCount_j
loJResp.J = j
lcStrVal = loJResp.StringOf("workspaces[i].macros[j]")
j = j + 1
ENDDO
j = 0
lnCount_j = loJResp.SizeOfArray("workspaces[i].selected_macros")
DO WHILE j < lnCount_j
loJResp.J = j
lcTitle = loJResp.StringOf("workspaces[i].selected_macros[j].title")
lcActive = loJResp.StringOf("workspaces[i].selected_macros[j].active")
lcCreated_at = loJResp.StringOf("workspaces[i].selected_macros[j].created_at")
lcDefault = loJResp.StringOf("workspaces[i].selected_macros[j].default")
lcDescription = loJResp.StringOf("workspaces[i].selected_macros[j].description")
lcId = loJResp.StringOf("workspaces[i].selected_macros[j].id")
lcPosition = loJResp.StringOf("workspaces[i].selected_macros[j].position")
lnElit_0 = loJResp.IntOf("workspaces[i].selected_macros[j].restriction.elit_0")
lnLoreme7 = loJResp.IntOf("workspaces[i].selected_macros[j].restriction.Loreme7")
lcUpdated_at = loJResp.StringOf("workspaces[i].selected_macros[j].updated_at")
lcUrl = loJResp.StringOf("workspaces[i].selected_macros[j].url")
lcApp_installation = loJResp.StringOf("workspaces[i].selected_macros[j].app_installation")
lcCategories = loJResp.StringOf("workspaces[i].selected_macros[j].categories")
lcPermissions = loJResp.StringOf("workspaces[i].selected_macros[j].permissions")
lcUsage_1h = loJResp.StringOf("workspaces[i].selected_macros[j].usage_1h")
lcUsage_7d = loJResp.StringOf("workspaces[i].selected_macros[j].usage_7d")
lcUsage_24h = loJResp.StringOf("workspaces[i].selected_macros[j].usage_24h")
lcUsage_30d = loJResp.StringOf("workspaces[i].selected_macros[j].usage_30d")
lnUt_2 = loJResp.BoolOf("workspaces[i].selected_macros[j].restriction.ut_2")
lnExf9 = loJResp.BoolOf("workspaces[i].selected_macros[j].restriction.exf9")
lnMagna_5 = loJResp.BoolOf("workspaces[i].selected_macros[j].restriction.magna_5")
lnNostrud_7 = loJResp.BoolOf("workspaces[i].selected_macros[j].restriction.nostrud_7")
lnEx69c = loJResp.IntOf("workspaces[i].selected_macros[j].restriction.ex69c")
lcUt_a = loJResp.StringOf("workspaces[i].selected_macros[j].restriction.ut_a")
lnMollit__ = loJResp.IntOf("workspaces[i].selected_macros[j].restriction.mollit__")
lnDeseruntc_ = loJResp.BoolOf("workspaces[i].selected_macros[j].restriction.deseruntc_")
lnConsequatd0 = loJResp.IntOf("workspaces[i].selected_macros[j].restriction.consequatd0")
lnId_4a = loJResp.BoolOf("workspaces[i].selected_macros[j].restriction.id_4a")
k = 0
lnCount_k = loJResp.SizeOfArray("workspaces[i].selected_macros[j].actions")
DO WHILE k < lnCount_k
loJResp.K = k
lcField = loJResp.StringOf("workspaces[i].selected_macros[j].actions[k].field")
lcValue = loJResp.StringOf("workspaces[i].selected_macros[j].actions[k].value")
k = k + 1
ENDDO
j = j + 1
ENDDO
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
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}"
}
]
}