Chilkat Online Tools

VB6 / Support API / Show Workspace

Back to Collection Items

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

Dim http As New ChilkatHttp
Dim success As Long

http.BasicAuth = 1
http.Login = "login"
http.Password = "password"

http.SetRequestHeader "Accept","application/json"

Dim sbResponseBody As New ChilkatStringBuilder
success = http.QuickGetSb("https://example.zendesk.com/api/v2/workspaces/:workspace_id",sbResponseBody)
If (success = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Dim jResp As New ChilkatJsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0

Debug.Print "Response Body:"
Debug.Print jResp.Emit()

Dim respStatusCode As Long
respStatusCode = http.LastStatus
Debug.Print "Response Status Code = " & respStatusCode
If (respStatusCode >= 400) Then
    Debug.Print "Response Header:"
    Debug.Print http.LastHeader
    Debug.Print "Failed."
    Exit Sub
End If

' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)

' {
'   "workspace": {
'     "activated": "<boolean>",
'     "apps": [
'       {
'         "ad_be": true,
'         "ead07": 69455617,
'         "adipisicinga": true
'       },
'       {
'         "fugiat_e": false,
'         "dolorf7": -57129708.70016649
'       }
'     ],
'     "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": {
'           "in_f25": true,
'           "nisid81": "reprehenderit anim nostrud id",
'           "minim_886": 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>"
'       },
'       {
'         "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": {
'           "culpa__d7": false,
'           "ad7": true,
'           "esse0": -82046233.9137964,
'           "veniam_f": -91185504
'         },
'         "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>"
'   }
' }

' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

Dim ad_be As Long
Dim ead07 As Long
Dim adipisicinga As Long
Dim fugiat_e As Long
Dim dolorf7 As String
Dim field As String
Dim operator As String
Dim value As String
Dim strVal As String
Dim title As String
Dim active As String
Dim created_at As String
Dim default As String
Dim description As String
Dim id As String
Dim position As String
Dim In_f25 As Long
Dim Nisid81 As String
Dim Minim_886 As Long
Dim updated_at As String
Dim url As String
Dim app_installation As String
Dim categories As String
Dim permissions As String
Dim usage_1h As String
Dim usage_7d As String
Dim usage_24h As String
Dim usage_30d As String
Dim Culpa__d7 As Long
Dim Ad7 As Long
Dim Esse0 As String
Dim Veniam_f As Long
Dim j As Long
Dim count_j As Long

Dim Activated As String
Activated = jResp.StringOf("workspace.activated")
Dim Created_at As String
Created_at = jResp.StringOf("workspace.created_at")
Dim Description As String
Description = jResp.StringOf("workspace.description")
Dim Id As String
Id = jResp.StringOf("workspace.id")
Dim Position As String
Position = jResp.StringOf("workspace.position")
Dim Prefer_workspace_app_order As String
Prefer_workspace_app_order = jResp.StringOf("workspace.prefer_workspace_app_order")
Dim Ticket_form_id As String
Ticket_form_id = jResp.StringOf("workspace.ticket_form_id")
Dim Title As String
Title = jResp.StringOf("workspace.title")
Dim Updated_at As String
Updated_at = jResp.StringOf("workspace.updated_at")
Dim v_Url As String
v_Url = jResp.StringOf("workspace.url")
Dim i As Long
i = 0
Dim count_i As Long
count_i = jResp.SizeOfArray("workspace.apps")
Do While i < count_i
    jResp.I = i
    ad_be = jResp.BoolOf("workspace.apps[i].ad_be")
    ead07 = jResp.IntOf("workspace.apps[i].ead07")
    adipisicinga = jResp.BoolOf("workspace.apps[i].adipisicinga")
    fugiat_e = jResp.BoolOf("workspace.apps[i].fugiat_e")
    dolorf7 = jResp.StringOf("workspace.apps[i].dolorf7")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("workspace.conditions.all")
Do While i < count_i
    jResp.I = i
    field = jResp.StringOf("workspace.conditions.all[i].field")
    operator = jResp.StringOf("workspace.conditions.all[i].operator")
    value = jResp.StringOf("workspace.conditions.all[i].value")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("workspace.conditions.any")
Do While i < count_i
    jResp.I = i
    field = jResp.StringOf("workspace.conditions.any[i].field")
    operator = jResp.StringOf("workspace.conditions.any[i].operator")
    value = jResp.StringOf("workspace.conditions.any[i].value")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("workspace.macro_ids")
Do While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("workspace.macro_ids[i]")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("workspace.macros")
Do While i < count_i
    jResp.I = i
    strVal = jResp.StringOf("workspace.macros[i]")
    i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("workspace.selected_macros")
Do While i < count_i
    jResp.I = i
    title = jResp.StringOf("workspace.selected_macros[i].title")
    active = jResp.StringOf("workspace.selected_macros[i].active")
    created_at = jResp.StringOf("workspace.selected_macros[i].created_at")
    default = jResp.StringOf("workspace.selected_macros[i].default")
    description = jResp.StringOf("workspace.selected_macros[i].description")
    id = jResp.StringOf("workspace.selected_macros[i].id")
    position = jResp.StringOf("workspace.selected_macros[i].position")
    In_f25 = jResp.BoolOf("workspace.selected_macros[i].restriction.in_f25")
    Nisid81 = jResp.StringOf("workspace.selected_macros[i].restriction.nisid81")
    Minim_886 = jResp.BoolOf("workspace.selected_macros[i].restriction.minim_886")
    updated_at = jResp.StringOf("workspace.selected_macros[i].updated_at")
    url = jResp.StringOf("workspace.selected_macros[i].url")
    app_installation = jResp.StringOf("workspace.selected_macros[i].app_installation")
    categories = jResp.StringOf("workspace.selected_macros[i].categories")
    permissions = jResp.StringOf("workspace.selected_macros[i].permissions")
    usage_1h = jResp.StringOf("workspace.selected_macros[i].usage_1h")
    usage_7d = jResp.StringOf("workspace.selected_macros[i].usage_7d")
    usage_24h = jResp.StringOf("workspace.selected_macros[i].usage_24h")
    usage_30d = jResp.StringOf("workspace.selected_macros[i].usage_30d")
    Culpa__d7 = jResp.BoolOf("workspace.selected_macros[i].restriction.culpa__d7")
    Ad7 = jResp.BoolOf("workspace.selected_macros[i].restriction.ad7")
    Esse0 = jResp.StringOf("workspace.selected_macros[i].restriction.esse0")
    Veniam_f = jResp.IntOf("workspace.selected_macros[i].restriction.veniam_f")
    j = 0
    count_j = jResp.SizeOfArray("workspace.selected_macros[i].actions")
    Do While j < count_j
        jResp.J = j
        field = jResp.StringOf("workspace.selected_macros[i].actions[j].field")
        value = jResp.StringOf("workspace.selected_macros[i].actions[j].value")
        j = j + 1
    Loop
    i = i + 1
Loop

Curl Command

curl  -u login:password -X GET
	-H "Accept: application/json"
https://example.zendesk.com/api/v2/workspaces/:workspace_id

Postman Collection Item JSON

{
  "name": "Show Workspace",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/v2/workspaces/:workspace_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "workspaces",
        ":workspace_id"
      ],
      "variable": [
        {
          "key": "workspace_id",
          "value": "<integer>"
        }
      ]
    },
    "description": "#### Allowed For\n* Admins\n"
  },
  "response": [
    {
      "name": "Successful 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/:workspace_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "workspaces",
            ":workspace_id"
          ],
          "variable": [
            {
              "key": "workspace_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"workspace\": {\n    \"activated\": \"<boolean>\",\n    \"apps\": [\n      {\n        \"ad_be\": true,\n        \"ead07\": 69455617,\n        \"adipisicinga\": true\n      },\n      {\n        \"fugiat_e\": false,\n        \"dolorf7\": -57129708.70016649\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          \"in_f25\": true,\n          \"nisid81\": \"reprehenderit anim nostrud id\",\n          \"minim_886\": 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        \"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          \"culpa__d7\": false,\n          \"ad7\": true,\n          \"esse0\": -82046233.9137964,\n          \"veniam_f\": -91185504\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}"
    }
  ]
}