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
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "name": "My Dashboard",
// "author": {
// "email": "Excepteur id tempor cillum",
// "handle": "culpa nostrud pariatur",
// "name": "cillum minim"
// },
// "created": "1966-02-10T07:56:34.100Z",
// "dashboard_count": 38191328,
// "id": 17219875,
// "is_favorite": false,
// "modified": "1943-12-25T04:37:37.575Z",
// "type": "manual_dashboard_list"
// }
json := chilkat.NewJsonObject()
json.UpdateString("name","My Dashboard")
json.UpdateString("author.email","Excepteur id tempor cillum")
json.UpdateString("author.handle","culpa nostrud pariatur")
json.UpdateString("author.name","cillum minim")
json.UpdateString("created","1966-02-10T07:56:34.100Z")
json.UpdateInt("dashboard_count",38191328)
json.UpdateInt("id",17219875)
json.UpdateBool("is_favorite",false)
json.UpdateString("modified","1943-12-25T04:37:37.575Z")
json.UpdateString("type","manual_dashboard_list")
http.SetRequestHeader("Content-Type","application/json")
http.SetRequestHeader("Accept","application/json")
sbRequestBody := chilkat.NewStringBuilder()
json.EmitSb(sbRequestBody)
resp := http.PTextSb("PUT","https://api.app.ddog-gov.com/api/v1/dashboard/lists/manual/:list_id",sbRequestBody,"utf-8","application/json",false,false)
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
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()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
return
}
resp.DisposeHttpResponse()
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "name": "My Dashboard",
// "author": {
// "email": "Excepteur id tempor cillum",
// "handle": "culpa nostrud pariatur",
// "name": "cillum minim"
// },
// "created": "1966-02-10T07:56:34.100Z",
// "dashboard_count": 38191328,
// "id": 17219875,
// "is_favorite": false,
// "modified": "1943-12-25T04:37:37.575Z",
// "type": "manual_dashboard_list"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
name := jResp.StringOf("name")
v_Email_Ref.html">Email := jResp.StringOf("author.email")
Handle := jResp.StringOf("author.handle")
Name := jResp.StringOf("author.name")
created := jResp.StringOf("created")
dashboard_count := jResp.IntOf("dashboard_count")
id := jResp.IntOf("id")
is_favorite := jResp.BoolOf("is_favorite")
modified := jResp.StringOf("modified")
v_type := jResp.StringOf("type")
http.DisposeHttp()
json.DisposeJsonObject()
sbRequestBody.DisposeStringBuilder()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
Curl Command
curl -X PUT
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"name": "My Dashboard",
"author": {
"email": "Excepteur id tempor cillum",
"handle": "culpa nostrud pariatur",
"name": "cillum minim"
},
"created": "1966-02-10T07:56:34.100Z",
"dashboard_count": 38191328,
"id": 17219875,
"is_favorite": false,
"modified": "1943-12-25T04:37:37.575Z",
"type": "manual_dashboard_list"
}'
https://api.app.ddog-gov.com/api/v1/dashboard/lists/manual/:list_id
Postman Collection Item JSON
{
"name": "Update a dashboard list",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/lists/manual/:list_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"lists",
"manual",
":list_id"
],
"variable": [
{
"key": "list_id",
"value": "-62147425"
}
]
},
"description": "Update the name of a dashboard list."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/lists/manual/:list_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"lists",
"manual",
":list_id"
],
"variable": [
{
"key": "list_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/lists/manual/:list_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"lists",
"manual",
":list_id"
],
"variable": [
{
"key": "list_id"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Forbidden",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/lists/manual/:list_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"lists",
"manual",
":list_id"
],
"variable": [
{
"key": "list_id"
}
]
}
},
"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": "Not Found",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/lists/manual/:list_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"lists",
"manual",
":list_id"
],
"variable": [
{
"key": "list_id"
}
]
}
},
"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": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"My Dashboard\",\n \"author\": {\n \"email\": \"Excepteur id tempor cillum\",\n \"handle\": \"culpa nostrud pariatur\",\n \"name\": \"cillum minim\"\n },\n \"created\": \"1966-02-10T07:56:34.100Z\",\n \"dashboard_count\": 38191328,\n \"id\": 17219875,\n \"is_favorite\": false,\n \"modified\": \"1943-12-25T04:37:37.575Z\",\n \"type\": \"manual_dashboard_list\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/dashboard/lists/manual/:list_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"dashboard",
"lists",
"manual",
":list_id"
],
"variable": [
{
"key": "list_id"
}
]
}
},
"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}"
}
]
}