Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global_Ref.html">Global Unlock Sample for sample code.
http := chilkat.NewHttp()
var success bool
queryParams := chilkat.NewJsonObject()
queryParams.UpdateString("filter[shared]","false")
queryParams.UpdateString("filter[deleted]","false")
http.SetRequestHeader("Accept","application/json")
resp := http.QuickRequestParams("GET","https://api.app.ddog-gov.com/api/v1/dashboard",queryParams)
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
queryParams.DisposeJsonObject()
return
}
sbResponseBody := chilkat.NewStringBuilder()
resp.GetBodySb(sbResponseBody)
jResp := chilkat.NewJsonObject()
jResp.LoadSb(sbResponseBody)
jResp.SetEmitCompact(false)
fmt.Println("Response Body:")
fmt.Println(*jResp.Emit())
respStatusCode := resp.StatusCode()
fmt.Println("Response Status Code = ", respStatusCode)
if respStatusCode >= 400 {
fmt.Println("Response Header:")
fmt.Println(resp.Header())
fmt.Println("Failed.")
resp.DisposeHttpResponse()
http.DisposeHttp()
queryParams.DisposeJsonObject()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
return
}
resp.DisposeHttpResponse()
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "dashboards": [
// {
// "author_handle": "Duis tempor ex",
// "created_at": "1963-12-20T01:10:02.870Z",
// "description": "esse cillum laboris",
// "id": "do Ut",
// "is_read_only": true,
// "layout_type": "ordered",
// "modified_at": "1958-09-05T14:28:29.291Z",
// "title": "nulla velit tempor",
// "url": "quis laboris irure id"
// },
// {
// "author_handle": "cup",
// "created_at": "1992-05-21T18:14:01.464Z",
// "description": "proident incididunt dolore",
// "id": "in deserunt irure",
// "is_read_only": false,
// "layout_type": "ordered",
// "modified_at": "1971-12-02T02:50:20.074Z",
// "title": "ut dolor in consequat fugiat",
// "url": "culpa Duis mollit"
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
var author_handle *string = new(string)
var created_at *string = new(string)
var description *string = new(string)
var id *string = new(string)
var is_read_only bool
var layout_type *string = new(string)
var modified_at *string = new(string)
var title *string = new(string)
var url *string = new(string)
i := 0
count_i := jResp.SizeOfArray("dashboards")
for i < count_i {
jResp.SetI(i)
author_handle = jResp.StringOf("dashboards[i].author_handle")
created_at = jResp.StringOf("dashboards[i].created_at")
description = jResp.StringOf("dashboards[i].description")
id = jResp.StringOf("dashboards[i].id")
is_read_only = jResp.BoolOf("dashboards[i].is_read_only")
layout_type = jResp.StringOf("dashboards[i].layout_type")
modified_at = jResp.StringOf("dashboards[i].modified_at")
title = jResp.StringOf("dashboards[i].title")
url = jResp.StringOf("dashboards[i].url")
i = i + 1
}
http.DisposeHttp()
queryParams.DisposeJsonObject()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
Curl Command
curl -G -d "filter[shared]=false"
-d "filter[deleted]=false"
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/dashboard
Postman Collection Item JSON
{
"name": "Get all dashboards",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard?filter[shared]=false&filter[deleted]=false",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard"
],
"query": [
{
"key": "filter[shared]",
"value": "false",
"description": "When `true`, this query only returns shared custom created\nor cloned dashboards."
},
{
"key": "filter[deleted]",
"value": "false",
"description": "When `true`, this query returns only deleted custom-created\nor cloned dashboards. This parameter is incompatible with `filter[shared]`."
}
]
},
"description": "Get all dashboards.\n\n**Note**: This query will only return custom created or cloned dashboards.\nThis query will not return preset dashboards."
},
"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?filter[shared]=false&filter[deleted]=false",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard"
],
"query": [
{
"key": "filter[shared]",
"value": "false",
"description": "When `true`, this query only returns shared custom created\nor cloned dashboards."
},
{
"key": "filter[deleted]",
"value": "false",
"description": "When `true`, this query returns only deleted custom-created\nor cloned dashboards. This parameter is incompatible with `filter[shared]`."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"dashboards\": [\n {\n \"author_handle\": \"Duis tempor ex\",\n \"created_at\": \"1963-12-20T01:10:02.870Z\",\n \"description\": \"esse cillum laboris\",\n \"id\": \"do Ut\",\n \"is_read_only\": true,\n \"layout_type\": \"ordered\",\n \"modified_at\": \"1958-09-05T14:28:29.291Z\",\n \"title\": \"nulla velit tempor\",\n \"url\": \"quis laboris irure id\"\n },\n {\n \"author_handle\": \"cup\",\n \"created_at\": \"1992-05-21T18:14:01.464Z\",\n \"description\": \"proident incididunt dolore\",\n \"id\": \"in deserunt irure\",\n \"is_read_only\": false,\n \"layout_type\": \"ordered\",\n \"modified_at\": \"1971-12-02T02:50:20.074Z\",\n \"title\": \"ut dolor in consequat fugiat\",\n \"url\": \"culpa Duis mollit\"\n }\n ]\n}"
},
{
"name": "Authentication Error",
"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?filter[shared]=false&filter[deleted]=false",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard"
],
"query": [
{
"key": "filter[shared]",
"value": "false",
"description": "When `true`, this query only returns shared custom created\nor cloned dashboards."
},
{
"key": "filter[deleted]",
"value": "false",
"description": "When `true`, this query returns only deleted custom-created\nor cloned dashboards. This parameter is incompatible with `filter[shared]`."
}
]
}
},
"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": "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?filter[shared]=false&filter[deleted]=false",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard"
],
"query": [
{
"key": "filter[shared]",
"value": "false",
"description": "When `true`, this query only returns shared custom created\nor cloned dashboards."
},
{
"key": "filter[deleted]",
"value": "false",
"description": "When `true`, this query returns only deleted custom-created\nor cloned dashboards. This parameter is incompatible with `filter[shared]`."
}
]
}
},
"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}"
}
]
}