DataFlex / Support API / List Workspaces
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sActivated
String sCreated_at
String sDescription
String sId
String sPosition
String sPrefer_workspace_app_order
String sTicket_form_id
String sTitle
String sUpdated_at
String sUrl
Integer j
Integer iCount_j
Boolean iUt_1
String sLorem_ec
String sSed_a
String sLaborum_
Integer iDolore_72
Boolean iDuis_e27
Boolean iDo_7b
Boolean iEu_6
String sField
String sOperator
String sValue
String sStrVal
String sActive
String sDefault
Integer iElit_0
Integer iLoreme7
String sApp_installation
String sCategories
String sPermissions
String sUsage_1h
String sUsage_7d
String sUsage_24h
String sUsage_30d
Boolean iUt_2
Boolean iExf9
Boolean iMagna_5
Boolean iNostrud_7
Integer iEx69c
String sUt_a
Integer iMollit__
Boolean iDeseruntc_
Integer iConsequatd0
Boolean iId_4a
Integer k
Integer iCount_k
String sCount
String sNext_page
String sPrevious_page
Integer i
Integer iCount_i
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "login"
Set ComPassword Of hoHttp To "password"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://example.zendesk.com/api/v2/workspaces" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// 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
Get ComStringOf Of hoJResp "count" To sCount
Get ComStringOf Of hoJResp "next_page" To sNext_page
Get ComStringOf Of hoJResp "previous_page" To sPrevious_page
Move 0 To i
Get ComSizeOfArray Of hoJResp "workspaces" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "workspaces[i].activated" To sActivated
Get ComStringOf Of hoJResp "workspaces[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "workspaces[i].description" To sDescription
Get ComStringOf Of hoJResp "workspaces[i].id" To sId
Get ComStringOf Of hoJResp "workspaces[i].position" To sPosition
Get ComStringOf Of hoJResp "workspaces[i].prefer_workspace_app_order" To sPrefer_workspace_app_order
Get ComStringOf Of hoJResp "workspaces[i].ticket_form_id" To sTicket_form_id
Get ComStringOf Of hoJResp "workspaces[i].title" To sTitle
Get ComStringOf Of hoJResp "workspaces[i].updated_at" To sUpdated_at
Get ComStringOf Of hoJResp "workspaces[i].url" To sUrl
Move 0 To j
Get ComSizeOfArray Of hoJResp "workspaces[i].apps" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComBoolOf Of hoJResp "workspaces[i].apps[j].ut_1" To iUt_1
Get ComStringOf Of hoJResp "workspaces[i].apps[j].Lorem_ec" To sLorem_ec
Get ComStringOf Of hoJResp "workspaces[i].apps[j].sed_a" To sSed_a
Get ComStringOf Of hoJResp "workspaces[i].apps[j].laborum_" To sLaborum_
Get ComIntOf Of hoJResp "workspaces[i].apps[j].dolore_72" To iDolore_72
Get ComBoolOf Of hoJResp "workspaces[i].apps[j].Duis_e27" To iDuis_e27
Get ComBoolOf Of hoJResp "workspaces[i].apps[j].do_7b" To iDo_7b
Get ComBoolOf Of hoJResp "workspaces[i].apps[j].eu_6" To iEu_6
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "workspaces[i].conditions.all" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "workspaces[i].conditions.all[j].field" To sField
Get ComStringOf Of hoJResp "workspaces[i].conditions.all[j].operator" To sOperator
Get ComStringOf Of hoJResp "workspaces[i].conditions.all[j].value" To sValue
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "workspaces[i].conditions.any" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "workspaces[i].conditions.any[j].field" To sField
Get ComStringOf Of hoJResp "workspaces[i].conditions.any[j].operator" To sOperator
Get ComStringOf Of hoJResp "workspaces[i].conditions.any[j].value" To sValue
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "workspaces[i].macro_ids" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "workspaces[i].macro_ids[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "workspaces[i].macros" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "workspaces[i].macros[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJResp "workspaces[i].selected_macros" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJResp To j
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].title" To sTitle
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].active" To sActive
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].created_at" To sCreated_at
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].default" To sDefault
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].description" To sDescription
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].id" To sId
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].position" To sPosition
Get ComIntOf Of hoJResp "workspaces[i].selected_macros[j].restriction.elit_0" To iElit_0
Get ComIntOf Of hoJResp "workspaces[i].selected_macros[j].restriction.Loreme7" To iLoreme7
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].updated_at" To sUpdated_at
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].url" To sUrl
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].app_installation" To sApp_installation
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].categories" To sCategories
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].permissions" To sPermissions
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].usage_1h" To sUsage_1h
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].usage_7d" To sUsage_7d
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].usage_24h" To sUsage_24h
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].usage_30d" To sUsage_30d
Get ComBoolOf Of hoJResp "workspaces[i].selected_macros[j].restriction.ut_2" To iUt_2
Get ComBoolOf Of hoJResp "workspaces[i].selected_macros[j].restriction.exf9" To iExf9
Get ComBoolOf Of hoJResp "workspaces[i].selected_macros[j].restriction.magna_5" To iMagna_5
Get ComBoolOf Of hoJResp "workspaces[i].selected_macros[j].restriction.nostrud_7" To iNostrud_7
Get ComIntOf Of hoJResp "workspaces[i].selected_macros[j].restriction.ex69c" To iEx69c
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].restriction.ut_a" To sUt_a
Get ComIntOf Of hoJResp "workspaces[i].selected_macros[j].restriction.mollit__" To iMollit__
Get ComBoolOf Of hoJResp "workspaces[i].selected_macros[j].restriction.deseruntc_" To iDeseruntc_
Get ComIntOf Of hoJResp "workspaces[i].selected_macros[j].restriction.consequatd0" To iConsequatd0
Get ComBoolOf Of hoJResp "workspaces[i].selected_macros[j].restriction.id_4a" To iId_4a
Move 0 To k
Get ComSizeOfArray Of hoJResp "workspaces[i].selected_macros[j].actions" To iCount_k
While (k < iCount_k)
Set ComK Of hoJResp To k
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].actions[k].field" To sField
Get ComStringOf Of hoJResp "workspaces[i].selected_macros[j].actions[k].value" To sValue
Move (k + 1) To k
Loop
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure
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}"
}
]
}