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.SetRequestHeader "Accept","application/json"
Dim sbResponseBody As New ChilkatStringBuilder
success = http.QuickGetSb("https://api.app.ddog-gov.com/api/v1/dashboard/public/:token",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)
' {
' "dashboard_id": "123-abc-456",
' "dashboard_type": "custom_timeboard",
' "author": {
' "handle": "test@datadoghq.com",
' "name": "consequat irure sit"
' },
' "created_at": "2008-04-06T04:45:45.510Z",
' "global_time": {
' "live_span": "1h"
' },
' "global_time_selectable_enabled": false,
' "public_url": "fugiat esse mollit adipisicing",
' "selectable_template_vars": [
' {
' "default_value": "*",
' "name": "exampleVar",
' "prefix": "test",
' "visible_tags": [
' "selectableValue1",
' "selectableValue2"
' ]
' }
' ],
' "share_list": [
' "test@datadoghq.com",
' "test2@email.com"
' ],
' "share_type": "open",
' "token": "dolor fugiat consectetur ex"
' }
' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Dim default_value As String
Dim name As String
Dim prefix As String
Dim j As Long
Dim count_j As Long
Dim strVal As String
Dim dashboard_id As String
dashboard_id = jResp.StringOf("dashboard_id")
Dim dashboard_type As String
dashboard_type = jResp.StringOf("dashboard_type")
Dim Handle As String
Handle = jResp.StringOf("author.handle")
Dim Name As String
Name = jResp.StringOf("author.name")
Dim created_at As String
created_at = jResp.StringOf("created_at")
Dim Live_span As String
Live_span = jResp.StringOf("global_time.live_span")
Dim global_time_selectable_enabled As Long
global_time_selectable_enabled = jResp.BoolOf("global_time_selectable_enabled")
Dim public_url As String
public_url = jResp.StringOf("public_url")
Dim share_type As String
share_type = jResp.StringOf("share_type")
Dim token As String
token = jResp.StringOf("token")
Dim i As Long
i = 0
Dim count_i As Long
count_i = jResp.SizeOfArray("selectable_template_vars")
Do While i < count_i
jResp.I = i
default_value = jResp.StringOf("selectable_template_vars[i].default_value")
name = jResp.StringOf("selectable_template_vars[i].name")
prefix = jResp.StringOf("selectable_template_vars[i].prefix")
j = 0
count_j = jResp.SizeOfArray("selectable_template_vars[i].visible_tags")
Do While j < count_j
jResp.J = j
strVal = jResp.StringOf("selectable_template_vars[i].visible_tags[j]")
j = j + 1
Loop
i = i + 1
Loop
i = 0
count_i = jResp.SizeOfArray("share_list")
Do While i < count_i
jResp.I = i
strVal = jResp.StringOf("share_list[i]")
i = i + 1
Loop
Curl Command
curl -X GET
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/dashboard/public/:token
Postman Collection Item JSON
{
"name": "Get a shared dashboard",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/public/:token",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"public",
":token"
],
"variable": [
{
"key": "token",
"value": "tempor Ut sed velit"
}
]
},
"description": "Fetch an existing shared dashboard's sharing metadata associated with the specified token."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/public/:token",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"public",
":token"
],
"variable": [
{
"key": "token"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"dashboard_id\": \"123-abc-456\",\n \"dashboard_type\": \"custom_timeboard\",\n \"author\": {\n \"handle\": \"test@datadoghq.com\",\n \"name\": \"consequat irure sit\"\n },\n \"created_at\": \"2008-04-06T04:45:45.510Z\",\n \"global_time\": {\n \"live_span\": \"1h\"\n },\n \"global_time_selectable_enabled\": false,\n \"public_url\": \"fugiat esse mollit adipisicing\",\n \"selectable_template_vars\": [\n {\n \"default_value\": \"*\",\n \"name\": \"exampleVar\",\n \"prefix\": \"test\",\n \"visible_tags\": [\n \"selectableValue1\",\n \"selectableValue2\"\n ]\n }\n ],\n \"share_list\": [\n \"test@datadoghq.com\",\n \"test2@email.com\"\n ],\n \"share_type\": \"open\",\n \"token\": \"dolor fugiat consectetur ex\"\n}"
},
{
"name": "Forbidden",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/public/:token",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"public",
":token"
],
"variable": [
{
"key": "token"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Shared Dashboard Not Found",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/public/:token",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"public",
":token"
],
"variable": [
{
"key": "token"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Too many requests",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/public/:token",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"public",
":token"
],
"variable": [
{
"key": "token"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
}
]
}