autoit / Support API / List Workspaces
Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oHttp.BasicAuth = True
$oHttp.Login = "login"
$oHttp.Password = "password"
$oHttp.SetRequestHeader "Accept","application/json"
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://example.zendesk.com/api/v2/workspaces",$oSbResponseBody)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oHttp.LastHeader & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
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
Local $sActivated
Local $sCreated_at
Local $sDescription
Local $sId
Local $sPosition
Local $sPrefer_workspace_app_order
Local $sTicket_form_id
Local $sTitle
Local $sUpdated_at
Local $sUrl
Local $iJ
Local $iCount_j
Local $bUt_1
Local $sLorem_ec
Local $sed_a
Local $sLaborum_
Local $iDolore_72
Local $bDuis_e27
Local $bDo_7b
Local $bEu_6
Local $sField
Local $sOperator
Local $sValue
Local $strVal
Local $sActive
Local $sDefault
Local $iElit_0
Local $iLoreme7
Local $sApp_installation
Local $sCategories
Local $sPermissions
Local $sUsage_1h
Local $sUsage_7d
Local $sUsage_24h
Local $sUsage_30d
Local $bUt_2
Local $bExf9
Local $bMagna_5
Local $bNostrud_7
Local $iEx69c
Local $sUt_a
Local $iMollit__
Local $bDeseruntc_
Local $iConsequatd0
Local $bId_4a
Local $iK
Local $iCount_k
Local $sCount = $oJResp.StringOf("count")
Local $sNext_page = $oJResp.StringOf("next_page")
Local $sPrevious_page = $oJResp.StringOf("previous_page")
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("workspaces")
While $i < $iCount_i
$oJResp.I = $i
$sActivated = $oJResp.StringOf("workspaces[i].activated")
$sCreated_at = $oJResp.StringOf("workspaces[i].created_at")
$sDescription = $oJResp.StringOf("workspaces[i].description")
$sId = $oJResp.StringOf("workspaces[i].id")
$sPosition = $oJResp.StringOf("workspaces[i].position")
$sPrefer_workspace_app_order = $oJResp.StringOf("workspaces[i].prefer_workspace_app_order")
$sTicket_form_id = $oJResp.StringOf("workspaces[i].ticket_form_id")
$sTitle = $oJResp.StringOf("workspaces[i].title")
$sUpdated_at = $oJResp.StringOf("workspaces[i].updated_at")
$sUrl = $oJResp.StringOf("workspaces[i].url")
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("workspaces[i].apps")
While $iJ < $iCount_j
$oJResp.J = $iJ
$bUt_1 = $oJResp.BoolOf("workspaces[i].apps[j].ut_1")
$sLorem_ec = $oJResp.StringOf("workspaces[i].apps[j].Lorem_ec")
$sed_a = $oJResp.StringOf("workspaces[i].apps[j].sed_a")
$sLaborum_ = $oJResp.StringOf("workspaces[i].apps[j].laborum_")
$iDolore_72 = $oJResp.IntOf("workspaces[i].apps[j].dolore_72")
$bDuis_e27 = $oJResp.BoolOf("workspaces[i].apps[j].Duis_e27")
$bDo_7b = $oJResp.BoolOf("workspaces[i].apps[j].do_7b")
$bEu_6 = $oJResp.BoolOf("workspaces[i].apps[j].eu_6")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("workspaces[i].conditions.all")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sField = $oJResp.StringOf("workspaces[i].conditions.all[j].field")
$sOperator = $oJResp.StringOf("workspaces[i].conditions.all[j].operator")
$sValue = $oJResp.StringOf("workspaces[i].conditions.all[j].value")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("workspaces[i].conditions.any")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sField = $oJResp.StringOf("workspaces[i].conditions.any[j].field")
$sOperator = $oJResp.StringOf("workspaces[i].conditions.any[j].operator")
$sValue = $oJResp.StringOf("workspaces[i].conditions.any[j].value")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("workspaces[i].macro_ids")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("workspaces[i].macro_ids[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("workspaces[i].macros")
While $iJ < $iCount_j
$oJResp.J = $iJ
$strVal = $oJResp.StringOf("workspaces[i].macros[j]")
$iJ = $iJ + 1
Wend
$iJ = 0
$iCount_j = $oJResp.SizeOfArray("workspaces[i].selected_macros")
While $iJ < $iCount_j
$oJResp.J = $iJ
$sTitle = $oJResp.StringOf("workspaces[i].selected_macros[j].title")
$sActive = $oJResp.StringOf("workspaces[i].selected_macros[j].active")
$sCreated_at = $oJResp.StringOf("workspaces[i].selected_macros[j].created_at")
$sDefault = $oJResp.StringOf("workspaces[i].selected_macros[j].default")
$sDescription = $oJResp.StringOf("workspaces[i].selected_macros[j].description")
$sId = $oJResp.StringOf("workspaces[i].selected_macros[j].id")
$sPosition = $oJResp.StringOf("workspaces[i].selected_macros[j].position")
$iElit_0 = $oJResp.IntOf("workspaces[i].selected_macros[j].restriction.elit_0")
$iLoreme7 = $oJResp.IntOf("workspaces[i].selected_macros[j].restriction.Loreme7")
$sUpdated_at = $oJResp.StringOf("workspaces[i].selected_macros[j].updated_at")
$sUrl = $oJResp.StringOf("workspaces[i].selected_macros[j].url")
$sApp_installation = $oJResp.StringOf("workspaces[i].selected_macros[j].app_installation")
$sCategories = $oJResp.StringOf("workspaces[i].selected_macros[j].categories")
$sPermissions = $oJResp.StringOf("workspaces[i].selected_macros[j].permissions")
$sUsage_1h = $oJResp.StringOf("workspaces[i].selected_macros[j].usage_1h")
$sUsage_7d = $oJResp.StringOf("workspaces[i].selected_macros[j].usage_7d")
$sUsage_24h = $oJResp.StringOf("workspaces[i].selected_macros[j].usage_24h")
$sUsage_30d = $oJResp.StringOf("workspaces[i].selected_macros[j].usage_30d")
$bUt_2 = $oJResp.BoolOf("workspaces[i].selected_macros[j].restriction.ut_2")
$bExf9 = $oJResp.BoolOf("workspaces[i].selected_macros[j].restriction.exf9")
$bMagna_5 = $oJResp.BoolOf("workspaces[i].selected_macros[j].restriction.magna_5")
$bNostrud_7 = $oJResp.BoolOf("workspaces[i].selected_macros[j].restriction.nostrud_7")
$iEx69c = $oJResp.IntOf("workspaces[i].selected_macros[j].restriction.ex69c")
$sUt_a = $oJResp.StringOf("workspaces[i].selected_macros[j].restriction.ut_a")
$iMollit__ = $oJResp.IntOf("workspaces[i].selected_macros[j].restriction.mollit__")
$bDeseruntc_ = $oJResp.BoolOf("workspaces[i].selected_macros[j].restriction.deseruntc_")
$iConsequatd0 = $oJResp.IntOf("workspaces[i].selected_macros[j].restriction.consequatd0")
$bId_4a = $oJResp.BoolOf("workspaces[i].selected_macros[j].restriction.id_4a")
$iK = 0
$iCount_k = $oJResp.SizeOfArray("workspaces[i].selected_macros[j].actions")
While $iK < $iCount_k
$oJResp.K = $iK
$sField = $oJResp.StringOf("workspaces[i].selected_macros[j].actions[k].field")
$sValue = $oJResp.StringOf("workspaces[i].selected_macros[j].actions[k].value")
$iK = $iK + 1
Wend
$iJ = $iJ + 1
Wend
$i = $i + 1
Wend
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}"
}
]
}