Interact with your dashboard lists through the API to make it easier to organize, find, and share all of your dashboards with your team and organization.
POST https://api.datadoghq.eu/api/v1/dashboardhttps://api.ddog-gov.com/api/v1/dashboardhttps://api.datadoghq.com/api/v1/dashboardhttps://api.us3.datadoghq.com/api/v1/dashboard
Create a dashboard using the specified options. When defining queries in your widgets, take note of which queries should have the as_count()
or as_rate()
modifiers appended.
Refer to the following documentation for more information on these modifiers.
Create a dashboard request body.
Field
Type
Description
author_handle
string
Identifier of the dashboard author.
created_at
date-time
Creation date of the dashboard.
description
string
Description of the dashboard.
id
string
ID of the dashboard.
is_read_only
boolean
Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
layout_type [required]
enum
Layout type of the dashboard.
Allowed enum values: ordered,free
modified_at
date-time
Modification date of the dashboard.
notify_list
[string]
List of handles of users to notify when changes are made to this dashboard.
template_variable_presets
[object]
Array of template variables saved views.
name
string
The name of the variable.
template_variables
[object]
List of variables.
name
string
The name of the variable.
value
string
The value of the template variable within the saved view.
template_variables
[object]
List of template variables for this dashboard.
default
string
The default value for the template variable on dashboard load.
name [required]
string
The name of the variable.
prefix
string
The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
title [required]
string
Title of the dashboard.
url
string
The URL of the dashboard.
widgets [required]
[object]
List of widgets to display on the dashboard.
id
int64
ID of the widget.
layout
object
The layout for a widget on a free dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
width [required]
int64
The width of the widget. Should be a non-negative integer.
x [required]
int64
The position of the widget on the x (horizontal) axis. Should be a non-negative integer.
y [required]
int64
The position of the widget on the y (vertical) axis. Should be a non-negative integer.
{
"description": "string",
"is_read_only": false,
"layout_type": "string",
"notify_list": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string"
}
]
}
],
"template_variables": [
{
"default": "my-host",
"name": "host1",
"prefix": "host"
}
],
"title": "",
"widgets": [
{
"definition": "[object Object]",
"id": "integer",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
OK
A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying key performance metrics, which enable you to monitor the health of your infrastructure.
Field
Type
Description
author_handle
string
Identifier of the dashboard author.
created_at
date-time
Creation date of the dashboard.
description
string
Description of the dashboard.
id
string
ID of the dashboard.
is_read_only
boolean
Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
layout_type [required]
enum
Layout type of the dashboard.
Allowed enum values: ordered,free
modified_at
date-time
Modification date of the dashboard.
notify_list
[string]
List of handles of users to notify when changes are made to this dashboard.
template_variable_presets
[object]
Array of template variables saved views.
name
string
The name of the variable.
template_variables
[object]
List of variables.
name
string
The name of the variable.
value
string
The value of the template variable within the saved view.
template_variables
[object]
List of template variables for this dashboard.
default
string
The default value for the template variable on dashboard load.
name [required]
string
The name of the variable.
prefix
string
The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
title [required]
string
Title of the dashboard.
url
string
The URL of the dashboard.
widgets [required]
[object]
List of widgets to display on the dashboard.
id
int64
ID of the widget.
layout
object
The layout for a widget on a free dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
width [required]
int64
The width of the widget. Should be a non-negative integer.
x [required]
int64
The position of the widget on the x (horizontal) axis. Should be a non-negative integer.
y [required]
int64
The position of the widget on the y (vertical) axis. Should be a non-negative integer.
{
"author_handle": "test@datadoghq.com",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "123-abc-456",
"is_read_only": false,
"layout_type": "string",
"modified_at": "2019-09-19T10:00:00.000Z",
"notify_list": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string"
}
]
}
],
"template_variables": [
{
"default": "my-host",
"name": "host1",
"prefix": "host"
}
],
"title": "",
"url": "/dashboard/123-abc-456/example-dashboard-title",
"widgets": [
{
"definition": "[object Object]",
"id": "integer",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/dashboard" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"layout_type": null,
"template_variables": [
{
"name": "host1"
}
],
"title": "",
"widgets": [
{
"definition": "[object Object]",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
body := *datadog.NewDashboard(datadog.DashboardLayoutType("ordered"), "Title_example", []datadog.Widget{*datadog.NewWidget(datadog.WidgetDefinition{AlertGraphWidgetDefinition: datadog.NewAlertGraphWidgetDefinition("AlertId_example", datadog.AlertGraphWidgetDefinitionType("alert_graph"), datadog.WidgetVizType("timeseries"))})}) // Dashboard | Create a dashboard request body.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.DashboardsApi.CreateDashboard(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateDashboard`: Dashboard
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from DashboardsApi.CreateDashboard:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
go "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DashboardsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
Dashboard body = new Dashboard(); // Dashboard | Create a dashboard request body.
try {
Dashboard result = apiInstance.createDashboard()
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#createDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
java "Example.java"
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
title = 'Average Memory Free Shell'
widgets = [{
'definition': {
'type': 'timeseries',
'requests': [
{'q': 'avg:system.mem.free{*}'}
],
'title': 'Average Memory Free'
}
}]
layout_type = 'ordered'
description = 'A dashboard with memory info.'
is_read_only = True
notify_list = ['user@domain.com']
template_variables = [{
'name': 'host1',
'prefix': 'host',
'default': 'my-host'
}]
saved_views = [{
'name': 'Saved views for hostname 2',
'template_variables': [{'name': 'host', 'value': '<HOSTNAME_2>'}]}
]
api.Dashboard.create(title=title,
widgets=widgets,
layout_type=layout_type,
description=description,
is_read_only=is_read_only,
notify_list=notify_list,
template_variables=template_variables,
template_variable_presets=saved_view)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import dashboards_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = dashboards_api.DashboardsApi(api_client)
body = Dashboard(
author_handle="test@datadoghq.com",
created_at=dateutil_parser('1970-01-01T00:00:00.00Z'),
description="description_example",
id="123-abc-456",
is_read_only=False,
layout_type=DashboardLayoutType("ordered"),
modified_at=dateutil_parser('1970-01-01T00:00:00.00Z'),
notify_list=[
"notify_list_example",
],
template_variable_presets=[
DashboardTemplateVariablePreset(
name="name_example",
template_variables=[
DashboardTemplateVariablePresetValue(
name="name_example",
value="value_example",
),
],
),
],
template_variables=[
DashboardTemplateVariable(
default="my-host",
name="host1",
prefix="host",
),
],
title="",
url="/dashboard/123-abc-456/example-dashboard-title",
widgets=[{"definition":{"requests":{"fill":{"q":"system.cpu.user"}},"type":"hostmap"}}],
) # Dashboard | Create a dashboard request body.
# example passing only required values which don't have defaults set
try:
# Create a new dashboard
api_response = api_instance.create_dashboard(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling DashboardsApi->create_dashboard: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
# Create a dashboard.
title = 'Average Memory Free Shell'
widgets = [{
'definition': {
'type' => 'timeseries',
'requests' => [
{'q' => 'avg:system.mem.free{*}'}
],
'title' => 'Average Memory Free'
}
}]
layout_type = 'ordered'
description = 'A dashboard with memory info.'
is_read_only = true
notify_list = ['user@domain.com']
template_variables = [{
'name' => 'host',
'prefix' => 'host',
'default' => '<HOSTNAME_1>'
}]
saved_view = [{
'name': 'Saved views for hostname 2',
'template_variables': [{'name': 'host', 'value': '<HOSTNAME_2>'}]}
]
dog.create_board(title, widgets, layout_type, {
:description => description,
:is_read_only => is_read_only,
:notify_list => notify_list,
:template_variables => template_variables,
:template_variable_presets => saved_view
})
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V1.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
end
api_instance = DatadogAPIClient::V1::DashboardsApi.new
body = DatadogAPIClient::V1::Dashboard.new({layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, title: 'title_example', widgets: [DatadogAPIClient::V1::Widget.new({definition: DatadogAPIClient::V1::AlertGraphWidgetDefinition.new({alert_id: 'alert_id_example', type: DatadogAPIClient::V1::AlertGraphWidgetDefinitionType::ALERT_GRAPH, viz_type: DatadogAPIClient::V1::WidgetVizType::TIMESERIES})})]}) # Dashboard | Create a dashboard request body.
begin
# Create a new dashboard
result = api_instance.create_dashboard(body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling DashboardsApi->create_dashboard: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
DELETE https://api.datadoghq.eu/api/v1/dashboard/{dashboard_id}https://api.ddog-gov.com/api/v1/dashboard/{dashboard_id}https://api.datadoghq.com/api/v1/dashboard/{dashboard_id}https://api.us3.datadoghq.com/api/v1/dashboard/{dashboard_id}
Delete a dashboard using the specified ID.
Name
Type
Description
dashboard_id [required]
string
The ID of the dashboard.
OK
Response from the delete dashboard call.
{
"deleted_dashboard_id": "string"
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Dashboards Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/dashboard/${dashboard_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
dashboardId := "dashboardId_example" // string | The ID of the dashboard.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.DashboardsApi.DeleteDashboard(ctx, dashboardId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.DeleteDashboard``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `DeleteDashboard`: DashboardDeleteResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from DashboardsApi.DeleteDashboard:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
go "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DashboardsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
String dashboardId = "dashboardId_example"; // String | The ID of the dashboard.
try {
DashboardDeleteResponse result = apiInstance.deleteDashboard(dashboardId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#deleteDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
java "Example.java"
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
dashboard_id = '<DASHBOARD_ID>'
api.Dashboard.delete(dashboard_id)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import dashboards_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = dashboards_api.DashboardsApi(api_client)
dashboard_id = "dashboard_id_example" # str | The ID of the dashboard.
# example passing only required values which don't have defaults set
try:
# Delete a dashboard
api_response = api_instance.delete_dashboard(dashboard_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DashboardsApi->delete_dashboard: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
dashboard_id = '<DASHBOARD_ID>'
dog.delete_board(dashboard_id)
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V1.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
end
api_instance = DatadogAPIClient::V1::DashboardsApi.new
dashboard_id = 'dashboard_id_example' # String | The ID of the dashboard.
begin
# Delete a dashboard
result = api_instance.delete_dashboard(dashboard_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling DashboardsApi->delete_dashboard: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
GET https://api.datadoghq.eu/api/v1/dashboard/{dashboard_id}https://api.ddog-gov.com/api/v1/dashboard/{dashboard_id}https://api.datadoghq.com/api/v1/dashboard/{dashboard_id}https://api.us3.datadoghq.com/api/v1/dashboard/{dashboard_id}
Get a dashboard using the specified ID.
Name
Type
Description
dashboard_id [required]
string
The ID of the dashboard.
OK
A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying key performance metrics, which enable you to monitor the health of your infrastructure.
Field
Type
Description
author_handle
string
Identifier of the dashboard author.
created_at
date-time
Creation date of the dashboard.
description
string
Description of the dashboard.
id
string
ID of the dashboard.
is_read_only
boolean
Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
layout_type [required]
enum
Layout type of the dashboard.
Allowed enum values: ordered,free
modified_at
date-time
Modification date of the dashboard.
notify_list
[string]
List of handles of users to notify when changes are made to this dashboard.
template_variable_presets
[object]
Array of template variables saved views.
name
string
The name of the variable.
template_variables
[object]
List of variables.
name
string
The name of the variable.
value
string
The value of the template variable within the saved view.
template_variables
[object]
List of template variables for this dashboard.
default
string
The default value for the template variable on dashboard load.
name [required]
string
The name of the variable.
prefix
string
The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
title [required]
string
Title of the dashboard.
url
string
The URL of the dashboard.
widgets [required]
[object]
List of widgets to display on the dashboard.
id
int64
ID of the widget.
layout
object
The layout for a widget on a free dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
width [required]
int64
The width of the widget. Should be a non-negative integer.
x [required]
int64
The position of the widget on the x (horizontal) axis. Should be a non-negative integer.
y [required]
int64
The position of the widget on the y (vertical) axis. Should be a non-negative integer.
{
"author_handle": "test@datadoghq.com",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "123-abc-456",
"is_read_only": false,
"layout_type": "string",
"modified_at": "2019-09-19T10:00:00.000Z",
"notify_list": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string"
}
]
}
],
"template_variables": [
{
"default": "my-host",
"name": "host1",
"prefix": "host"
}
],
"title": "",
"url": "/dashboard/123-abc-456/example-dashboard-title",
"widgets": [
{
"definition": "[object Object]",
"id": "integer",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Item Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/dashboard/${dashboard_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
dashboardId := "dashboardId_example" // string | The ID of the dashboard.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.DashboardsApi.GetDashboard(ctx, dashboardId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.GetDashboard``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetDashboard`: Dashboard
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from DashboardsApi.GetDashboard:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
go "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DashboardsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
String dashboardId = "dashboardId_example"; // String | The ID of the dashboard.
try {
Dashboard result = apiInstance.getDashboard(dashboardId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#getDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
java "Example.java"
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
dashboard_id = '<DASHBOARD_ID>'
api.Dashboard.get(dashboard_id)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import dashboards_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = dashboards_api.DashboardsApi(api_client)
dashboard_id = "dashboard_id_example" # str | The ID of the dashboard.
# example passing only required values which don't have defaults set
try:
# Get a dashboard
api_response = api_instance.get_dashboard(dashboard_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DashboardsApi->get_dashboard: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
dashboard_id = '<DASHBOARD_ID>'
dog.get_board(dashboard_id)
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V1.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
end
api_instance = DatadogAPIClient::V1::DashboardsApi.new
dashboard_id = 'dashboard_id_example' # String | The ID of the dashboard.
begin
# Get a dashboard
result = api_instance.get_dashboard(dashboard_id)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling DashboardsApi->get_dashboard: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
GET https://api.datadoghq.eu/api/v1/dashboardhttps://api.ddog-gov.com/api/v1/dashboardhttps://api.datadoghq.com/api/v1/dashboardhttps://api.us3.datadoghq.com/api/v1/dashboard
Get all dashboards.
Note: This query will only return custom created or cloned dashboards. This query will not return preset dashboards.
OK
Dashboard summary response.
Field
Type
Description
dashboards
[object]
List of dashboard definitions.
author_handle
string
Identifier of the dashboard author.
created_at
date-time
Creation date of the dashboard.
description
string
Description of the dashboard.
id
string
Dashboard identifier.
is_read_only
boolean
Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
layout_type
enum
Layout type of the dashboard.
Allowed enum values: ordered,free
modified_at
date-time
Modification date of the dashboard.
title
string
Title of the dashboard.
url
string
URL of the dashboard.
{
"dashboards": [
{
"author_handle": "string",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "string",
"is_read_only": false,
"layout_type": "string",
"modified_at": "2019-09-19T10:00:00.000Z",
"title": "string",
"url": "string"
}
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/dashboard" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.DashboardsApi.ListDashboards(ctx).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.ListDashboards``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListDashboards`: DashboardSummary
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from DashboardsApi.ListDashboards:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
go "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DashboardsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
try {
DashboardSummary result = apiInstance.listDashboards()
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#listDashboards");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
java "Example.java"
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
api.Dashboard.get_all()
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import dashboards_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = dashboards_api.DashboardsApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# Get all dashboards
api_response = api_instance.list_dashboards()
pprint(api_response)
except ApiException as e:
print("Exception when calling DashboardsApi->list_dashboards: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
dog.get_all_boards()
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V1.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
end
api_instance = DatadogAPIClient::V1::DashboardsApi.new
begin
# Get all dashboards
result = api_instance.list_dashboards
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling DashboardsApi->list_dashboards: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"
PUT https://api.datadoghq.eu/api/v1/dashboard/{dashboard_id}https://api.ddog-gov.com/api/v1/dashboard/{dashboard_id}https://api.datadoghq.com/api/v1/dashboard/{dashboard_id}https://api.us3.datadoghq.com/api/v1/dashboard/{dashboard_id}
Update a dashboard using the specified ID.
Name
Type
Description
dashboard_id [required]
string
The ID of the dashboard.
Update Dashboard request body.
Field
Type
Description
author_handle
string
Identifier of the dashboard author.
created_at
date-time
Creation date of the dashboard.
description
string
Description of the dashboard.
id
string
ID of the dashboard.
is_read_only
boolean
Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
layout_type [required]
enum
Layout type of the dashboard.
Allowed enum values: ordered,free
modified_at
date-time
Modification date of the dashboard.
notify_list
[string]
List of handles of users to notify when changes are made to this dashboard.
template_variable_presets
[object]
Array of template variables saved views.
name
string
The name of the variable.
template_variables
[object]
List of variables.
name
string
The name of the variable.
value
string
The value of the template variable within the saved view.
template_variables
[object]
List of template variables for this dashboard.
default
string
The default value for the template variable on dashboard load.
name [required]
string
The name of the variable.
prefix
string
The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
title [required]
string
Title of the dashboard.
url
string
The URL of the dashboard.
widgets [required]
[object]
List of widgets to display on the dashboard.
id
int64
ID of the widget.
layout
object
The layout for a widget on a free dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
width [required]
int64
The width of the widget. Should be a non-negative integer.
x [required]
int64
The position of the widget on the x (horizontal) axis. Should be a non-negative integer.
y [required]
int64
The position of the widget on the y (vertical) axis. Should be a non-negative integer.
{
"description": "string",
"is_read_only": false,
"layout_type": "string",
"notify_list": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string"
}
]
}
],
"template_variables": [
{
"default": "my-host",
"name": "host1",
"prefix": "host"
}
],
"title": "",
"widgets": [
{
"definition": "[object Object]",
"id": "integer",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
OK
A dashboard is Datadog’s tool for visually tracking, analyzing, and displaying key performance metrics, which enable you to monitor the health of your infrastructure.
Field
Type
Description
author_handle
string
Identifier of the dashboard author.
created_at
date-time
Creation date of the dashboard.
description
string
Description of the dashboard.
id
string
ID of the dashboard.
is_read_only
boolean
Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
layout_type [required]
enum
Layout type of the dashboard.
Allowed enum values: ordered,free
modified_at
date-time
Modification date of the dashboard.
notify_list
[string]
List of handles of users to notify when changes are made to this dashboard.
template_variable_presets
[object]
Array of template variables saved views.
name
string
The name of the variable.
template_variables
[object]
List of variables.
name
string
The name of the variable.
value
string
The value of the template variable within the saved view.
template_variables
[object]
List of template variables for this dashboard.
default
string
The default value for the template variable on dashboard load.
name [required]
string
The name of the variable.
prefix
string
The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
title [required]
string
Title of the dashboard.
url
string
The URL of the dashboard.
widgets [required]
[object]
List of widgets to display on the dashboard.
id
int64
ID of the widget.
layout
object
The layout for a widget on a free dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
width [required]
int64
The width of the widget. Should be a non-negative integer.
x [required]
int64
The position of the widget on the x (horizontal) axis. Should be a non-negative integer.
y [required]
int64
The position of the widget on the y (vertical) axis. Should be a non-negative integer.
{
"author_handle": "test@datadoghq.com",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "123-abc-456",
"is_read_only": false,
"layout_type": "string",
"modified_at": "2019-09-19T10:00:00.000Z",
"notify_list": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string"
}
]
}
],
"template_variables": [
{
"default": "my-host",
"name": "host1",
"prefix": "host"
}
],
"title": "",
"url": "/dashboard/123-abc-456/example-dashboard-title",
"widgets": [
{
"definition": "[object Object]",
"id": "integer",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Item Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/dashboard/${dashboard_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"layout_type": null,
"template_variables": [
{
"name": "host1"
}
],
"title": "",
"widgets": [
{
"definition": "[object Object]",
"layout": {
"height": 0,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
dashboardId := "dashboardId_example" // string | The ID of the dashboard.
body := *datadog.NewDashboard(datadog.DashboardLayoutType("ordered"), "Title_example", []datadog.Widget{*datadog.NewWidget(datadog.WidgetDefinition{AlertGraphWidgetDefinition: datadog.NewAlertGraphWidgetDefinition("AlertId_example", datadog.AlertGraphWidgetDefinitionType("alert_graph"), datadog.WidgetVizType("timeseries"))})}) // Dashboard | Update Dashboard request body.
configuration := datadog.NewConfiguration()
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.DashboardsApi.UpdateDashboard(ctx, dashboardId).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.UpdateDashboard``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateDashboard`: Dashboard
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from DashboardsApi.UpdateDashboard:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
go "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.DashboardsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
String dashboardId = "dashboardId_example"; // String | The ID of the dashboard.
Dashboard body = new Dashboard(); // Dashboard | Update Dashboard request body.
try {
Dashboard result = apiInstance.updateDashboard(dashboardId)
.body(body)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#updateDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import dashboards_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = dashboards_api.DashboardsApi(api_client)
dashboard_id = "dashboard_id_example" # str | The ID of the dashboard.
body = Dashboard(
author_handle="test@datadoghq.com",
created_at=dateutil_parser('1970-01-01T00:00:00.00Z'),
description="description_example",
id="123-abc-456",
is_read_only=False,
layout_type=DashboardLayoutType("ordered"),
modified_at=dateutil_parser('1970-01-01T00:00:00.00Z'),
notify_list=[
"notify_list_example",
],
template_variable_presets=[
DashboardTemplateVariablePreset(
name="name_example",
template_variables=[
DashboardTemplateVariablePresetValue(
name="name_example",
value="value_example",
),
],
),
],
template_variables=[
DashboardTemplateVariable(
default="my-host",
name="host1",
prefix="host",
),
],
title="",
url="/dashboard/123-abc-456/example-dashboard-title",
widgets=[{"definition":{"requests":{"fill":{"q":"system.cpu.user"}},"type":"hostmap"}}],
) # Dashboard | Update Dashboard request body.
# example passing only required values which don't have defaults set
try:
# Update a dashboard
api_response = api_instance.update_dashboard(dashboard_id, body)
pprint(api_response)
except ApiException as e:
print("Exception when calling DashboardsApi->update_dashboard: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
python3 "example.py"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V1.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
end
api_instance = DatadogAPIClient::V1::DashboardsApi.new
dashboard_id = 'dashboard_id_example' # String | The ID of the dashboard.
body = DatadogAPIClient::V1::Dashboard.new({layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, title: 'title_example', widgets: [DatadogAPIClient::V1::Widget.new({definition: DatadogAPIClient::V1::AlertGraphWidgetDefinition.new({alert_id: 'alert_id_example', type: DatadogAPIClient::V1::AlertGraphWidgetDefinitionType::ALERT_GRAPH, viz_type: DatadogAPIClient::V1::WidgetVizType::TIMESERIES})})]}) # Dashboard | Update Dashboard request body.
begin
# Update a dashboard
result = api_instance.update_dashboard(dashboard_id, body)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling DashboardsApi->update_dashboard: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="https://api.datadoghq.euhttps://api.ddog-gov.comhttps://api.datadoghq.comhttps://api.us3.datadoghq.com"
rb "example.rb"