Dashboards
Datadog の調査レポート: サーバーレスの状態 レポート: サーバーレスの状態
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

Dashboards

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.

Create a new dashboard

post https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/dashboard

Overview

Create a dashboard using the specified options.

Request

Body Data (required)

Create a dashboard request body.

Expand All

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.

definition [required]

object

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
      }
    }
  ]
}

Response

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.

Expand All

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.

definition [required]

object

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.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Authentication Error

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example


                                        # Curl command
curl -X post https://api.datadoghq.comhttps://api.datadoghq.eu/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"
    "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"),
            },
        },
    )

    body := datadog.Dashboard{AuthorHandle: "AuthorHandle_example", CreatedAt: "TODO", Description: "Description_example", Id: "Id_example", IsReadOnly: false, LayoutType: datadog.DashboardLayoutType{}, ModifiedAt: "TODO", NotifyList: []string{"NotifyList_example"), TemplateVariablePresets: []DashboardTemplateVariablePreset{datadog.DashboardTemplateVariablePreset{Name: "Name_example", TemplateVariables: []DashboardTemplateVariablePresetValue{datadog.DashboardTemplateVariablePresetValue{Name: "Name_example", Value: "Value_example"})}), TemplateVariables: []DashboardTemplateVariables{datadog.Dashboard_template_variables{Default: "Default_example", Name: "Name_example", Prefix: "Prefix_example"}), Title: "Title_example", Url: "Url_example", Widgets: []Widget{datadog.Widget{Definition: datadog.WidgetDefinition{AlertId: "AlertId_example", Time: datadog.WidgetTime{LiveSpan: datadog.WidgetLiveSpan{}}, Title: "Title_example", TitleAlign: datadog.WidgetTextAlign{}, TitleSize: "TitleSize_example", Type: datadog.ToplistWidgetDefinitionType{}, VizType: datadog.WidgetVizType{}, Precision: int64(123), TextAlign: datadog.WidgetTextAlign{}, Unit: "Unit_example", Requests: []ToplistWidgetRequest{datadog.ToplistWidgetRequest{ApmQuery: datadog.LogQueryDefinition{Compute: datadog.LogsQueryCompute{Aggregation: "Aggregation_example", Facet: "Facet_example", Interval: int64(123)}, GroupBy: []LogQueryDefinitionGroupBy{datadog.LogQueryDefinition_group_by{Facet: "Facet_example", Limit: int64(123), Sort: datadog.LogQueryDefinition_sort{Aggregation: "Aggregation_example", Facet: "Facet_example", Order: datadog.WidgetSort{}}}), Index: "Index_example", MultiCompute: []LogsQueryCompute{datadog.LogsQueryCompute{Aggregation: "Aggregation_example", Facet: "Facet_example", Interval: int64(123)}), Search: datadog.LogQueryDefinition_search{Query: "Query_example"}}, ConditionalFormats: []WidgetConditionalFormat{datadog.WidgetConditionalFormat{Comparator: datadog.WidgetComparator{}, CustomBgColor: "CustomBgColor_example", CustomFgColor: "CustomFgColor_example", HideValue: false, ImageUrl: "ImageUrl_example", Metric: "Metric_example", Palette: datadog.WidgetPalette{}, Timeframe: "Timeframe_example", Value: 123}), EventQuery: datadog.EventQueryDefinition{Search: "Search_example", TagsExecution: "TagsExecution_example"}, LogQuery: datadog.LogQueryDefinition{Compute: , GroupBy: []LogQueryDefinitionGroupBy{datadog.LogQueryDefinition_group_by{Facet: "Facet_example", Limit: int64(123), Sort: datadog.LogQueryDefinition_sort{Aggregation: "Aggregation_example", Facet: "Facet_example", Order: datadog.WidgetSort{}}}), Index: "Index_example", MultiCompute: []LogsQueryCompute{), Search: datadog.LogQueryDefinition_search{Query: "Query_example"}}, NetworkQuery: , ProcessQuery: datadog.ProcessQueryDefinition{FilterBy: []string{"FilterBy_example"), Limit: int64(123), Metric: "Metric_example", SearchBy: "SearchBy_example"}, Q: "Q_example", RumQuery: , Style: datadog.WidgetRequestStyle{LineType: datadog.WidgetLineType{}, LineWidth: datadog.WidgetLineWidth{}, Palette: "Palette_example"}}), Check: "Check_example", Group: []string{"Group_example"), GroupBy: []string{"GroupBy_example"), Grouping: datadog.WidgetGrouping{}, Tags: []string{"Tags_example"), LegendSize: datadog.WidgetLegendSize{}, ShowLegend: false, EventSize: datadog.WidgetEventSize{}, Query: "Query_example", TagsExecution: "TagsExecution_example", Color: "Color_example", FontSize: "FontSize_example", Text: "Text_example", LayoutType: datadog.WidgetLayoutType{}, Widgets: []Widget{datadog.Widget{Definition: datadog.WidgetDefinition{AlertId: "AlertId_example", Time: datadog.WidgetTime{LiveSpan: datadog.WidgetLiveSpan{}}, Title: "Title_example", TitleAlign: , TitleSize: "TitleSize_example", Type: datadog.ToplistWidgetDefinitionType{}, VizType: datadog.WidgetVizType{}, Precision: int64(123), TextAlign: , Unit: "Unit_example", Requests: []ToplistWidgetRequest{datadog.ToplistWidgetRequest{ApmQuery: , ConditionalFormats: []WidgetConditionalFormat{datadog.WidgetConditionalFormat{Comparator: datadog.WidgetComparator{}, CustomBgColor: "CustomBgColor_example", CustomFgColor: "CustomFgColor_example", HideValue: false, ImageUrl: "ImageUrl_example", Metric: "Metric_example", Palette: datadog.WidgetPalette{}, Timeframe: "Timeframe_example", Value: 123}), EventQuery: datadog.EventQueryDefinition{Search: "Search_example", TagsExecution: "TagsExecution_example"}, LogQuery: , NetworkQuery: , ProcessQuery: datadog.ProcessQueryDefinition{FilterBy: []string{"FilterBy_example"), Limit: int64(123), Metric: "Metric_example", SearchBy: "SearchBy_example"}, Q: "Q_example", RumQuery: , Style: datadog.WidgetRequestStyle{LineType: datadog.WidgetLineType{}, LineWidth: datadog.WidgetLineWidth{}, Palette: "Palette_example"}}), Check: "Check_example", Group: []string{"Group_example"), GroupBy: []string{"GroupBy_example"), Grouping: datadog.WidgetGrouping{}, Tags: []string{"Tags_example"), LegendSize: datadog.WidgetLegendSize{}, ShowLegend: false, EventSize: datadog.WidgetEventSize{}, Query: "Query_example", TagsExecution: "TagsExecution_example", Color: "Color_example", FontSize: "FontSize_example", Text: "Text_example", LayoutType: datadog.WidgetLayoutType{}, Widgets: []Widget{), Events: []WidgetEvent{datadog.WidgetEvent{Q: "Q_example", TagsExecution: "TagsExecution_example"}), Yaxis: datadog.WidgetAxis{IncludeZero: false, Label: "Label_example", Max: "Max_example", Min: "Min_example", Scale: "Scale_example"}, NoGroupHosts: false, NoMetricHosts: false, NodeType: datadog.WidgetNodeType{}, Notes: "Notes_example", Scope: []string{"Scope_example"), Style: datadog.HostMapWidgetDefinition_style{FillMax: "FillMax_example", FillMin: "FillMin_example", Palette: "Palette_example", PaletteFlip: false}, Url: "Url_example", Margin: datadog.WidgetMargin{}, Sizing: datadog.WidgetImageSizing{}, Columns: []string{"Columns_example"), Indexes: []string{"Indexes_example"), Logset: "Logset_example", MessageDisplay: datadog.WidgetMessageDisplay{}, ShowDateColumn: false, ShowMessageColumn: false, Sort: datadog.WidgetMonitorSummarySort{}, ColorPreference: datadog.WidgetColorPreference{}, Count: int64(123), DisplayFormat: datadog.WidgetServiceSummaryDisplayFormat{}, HideZeroCounts: false, ShowLastTriggered: false, Start: int64(123), SummaryType: datadog.WidgetSummaryType{}, BackgroundColor: "BackgroundColor_example", Content: "Content_example", ShowTick: false, TickEdge: datadog.WidgetTickEdge{}, TickPos: "TickPos_example", Autoscale: false, CustomUnit: "CustomUnit_example", ColorByGroups: []string{"ColorByGroups_example"), Xaxis: datadog.WidgetAxis{IncludeZero: false, Label: "Label_example", Max: "Max_example", Min: "Min_example", Scale: "Scale_example"}, ShowErrorBudget: false, SloId: "SloId_example", TimeWindows: []WidgetTimeWindows{datadog.WidgetTimeWindows{}), ViewMode: datadog.WidgetViewMode{}, ViewType: "ViewType_example", Filters: []string{"Filters_example"), Service: "Service_example", Env: "Env_example", ShowBreakdown: false, ShowDistribution: false, ShowErrors: false, ShowHits: false, ShowLatency: false, ShowResourceList: false, SizeFormat: datadog.WidgetSizeFormat{}, SpanName: "SpanName_example", Markers: []WidgetMarker{datadog.WidgetMarker{DisplayType: "DisplayType_example", Label: "Label_example", Time: "Time_example", Value: "Value_example"})}, Id: int64(123), Layout: datadog.WidgetLayout{Height: int64(123), Width: int64(123), X: int64(123), Y: int64(123)}}), Events: []WidgetEvent{datadog.WidgetEvent{Q: "Q_example", TagsExecution: "TagsExecution_example"}), Yaxis: , NoGroupHosts: false, NoMetricHosts: false, NodeType: datadog.WidgetNodeType{}, Notes: "Notes_example", Scope: []string{"Scope_example"), Style: datadog.HostMapWidgetDefinition_style{FillMax: "FillMax_example", FillMin: "FillMin_example", Palette: "Palette_example", PaletteFlip: false}, Url: "Url_example", Margin: datadog.WidgetMargin{}, Sizing: datadog.WidgetImageSizing{}, Columns: []string{"Columns_example"), Indexes: []string{"Indexes_example"), Logset: "Logset_example", MessageDisplay: datadog.WidgetMessageDisplay{}, ShowDateColumn: false, ShowMessageColumn: false, Sort: datadog.WidgetMonitorSummarySort{}, ColorPreference: datadog.WidgetColorPreference{}, Count: int64(123), DisplayFormat: datadog.WidgetServiceSummaryDisplayFormat{}, HideZeroCounts: false, ShowLastTriggered: false, Start: int64(123), SummaryType: datadog.WidgetSummaryType{}, BackgroundColor: "BackgroundColor_example", Content: "Content_example", ShowTick: false, TickEdge: datadog.WidgetTickEdge{}, TickPos: "TickPos_example", Autoscale: false, CustomUnit: "CustomUnit_example", ColorByGroups: []string{"ColorByGroups_example"), Xaxis: , ShowErrorBudget: false, SloId: "SloId_example", TimeWindows: []WidgetTimeWindows{datadog.WidgetTimeWindows{}), ViewMode: datadog.WidgetViewMode{}, ViewType: "ViewType_example", Filters: []string{"Filters_example"), Service: "Service_example", Env: "Env_example", ShowBreakdown: false, ShowDistribution: false, ShowErrors: false, ShowHits: false, ShowLatency: false, ShowResourceList: false, SizeFormat: datadog.WidgetSizeFormat{}, SpanName: "SpanName_example", Markers: []WidgetMarker{datadog.WidgetMarker{DisplayType: "DisplayType_example", Label: "Label_example", Time: "Time_example", Value: "Value_example"})}, Id: int64(123), Layout: datadog.WidgetLayout{Height: int64(123), Width: int64(123), X: int64(123), Y: int64(123)}})} // Dashboard | Create a dashboard request body.

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.DashboardsApi.CreateDashboard(ctx, 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
    fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`: %v\n", resp)
}
// Import classes:
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.models.*;
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 = api.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();
        }
    }
}
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_view = [{
    '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_views)
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
    })

Delete a dashboard

delete https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/dashboard/{dashboard_id}

Overview

Delete a dashboard using the specified ID.

Arguments

Path Parameters

Name

Type

Description

dashboard_id [required]

string

The ID of the dashboard.

Response

OK

Response from the delete dashboard call.

Expand All

Field

Type

Description

deleted_dashboard_id

string

ID of the deleted dashboard.

{
  "deleted_dashboard_id": "string"
}

Authentication Error

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Dashboards Not Found

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example


                                        # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command curl -X delete https://api.datadoghq.comhttps://api.datadoghq.eu/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"
    "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"),
            },
        },
    )

    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
    fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.DeleteDashboard`: %v\n", resp)
}
// Import classes:
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.models.*;
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 = api.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();
        }
    }
}
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)
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)

Get a dashboard

get https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/dashboard/{dashboard_id}

Overview

Get a dashboard using the specified ID.

Arguments

Path Parameters

Name

Type

Description

dashboard_id [required]

string

The ID of the dashboard.

Response

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.

Expand All

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.

definition [required]

object

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.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Item Not Found

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example


                                        # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command curl -X get https://api.datadoghq.comhttps://api.datadoghq.eu/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"
    "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"),
            },
        },
    )

    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
    fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.GetDashboard`: %v\n", resp)
}
// Import classes:
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.models.*;
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 = api.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();
        }
    }
}
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)
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)

Get all dashboards

get https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/dashboard

Overview

Get all dashboards.

Note: This query will only return custom created or cloned dashboards. This query will not return preset dashboards.

Response

OK

Dashboard summary response.

Expand All

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.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example


                                        # Curl command
curl -X get https://api.datadoghq.comhttps://api.datadoghq.eu/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"
    "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"),
            },
        },
    )


    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
    fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.ListDashboards`: %v\n", resp)
}
// Import classes:
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.models.*;
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 = api.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();
        }
    }
}
from datadog import initialize, api

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

initialize(**options)

api.Dashboard.get_all()
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()

Update a dashboard

put https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/dashboard/{dashboard_id}

Overview

Update a dashboard using the specified ID.

Arguments

Path Parameters

Name

Type

Description

dashboard_id [required]

string

The ID of the dashboard.

Request

Body Data (required)

Update Dashboard request body.

Expand All

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.

definition [required]

object

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
      }
    }
  ]
}

Response

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.

Expand All

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.

definition [required]

object

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.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Authentication Error

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Item Not Found

Error response object.

Expand All

Field

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example


                                        # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command curl -X put https://api.datadoghq.comhttps://api.datadoghq.eu/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"
    "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"),
            },
        },
    )

    dashboardId := "dashboardId_example" // string | The ID of the dashboard.
    body := datadog.Dashboard{AuthorHandle: "AuthorHandle_example", CreatedAt: "TODO", Description: "Description_example", Id: "Id_example", IsReadOnly: false, LayoutType: datadog.DashboardLayoutType{}, ModifiedAt: "TODO", NotifyList: []string{"NotifyList_example"), TemplateVariablePresets: []DashboardTemplateVariablePreset{datadog.DashboardTemplateVariablePreset{Name: "Name_example", TemplateVariables: []DashboardTemplateVariablePresetValue{datadog.DashboardTemplateVariablePresetValue{Name: "Name_example", Value: "Value_example"})}), TemplateVariables: []DashboardTemplateVariables{datadog.Dashboard_template_variables{Default: "Default_example", Name: "Name_example", Prefix: "Prefix_example"}), Title: "Title_example", Url: "Url_example", Widgets: []Widget{)} // Dashboard | Update Dashboard request body.

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.DashboardsApi.UpdateDashboard(ctx, dashboardId, 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
    fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.UpdateDashboard`: %v\n", resp)
}
// Import classes:
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.models.*;
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 = api.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();
        }
    }
}