- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
API를 통해 대시보드를 모두 관리하고 공유 대시보드에 액세스할 수 있습니다. 자세한 내용은 대시보드 페이지를 참고하세요.
POST https://api.ap1.datadoghq.com/api/v1/dashboardhttps://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/dashboardhttps://api.us5.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.
This endpoint requires the dashboards_write
permission.
OAuth apps require the dashboards_write
authorization scope to access this endpoint.
Create a dashboard request body.
항목
유형
설명
author_handle
string
Identifier of the dashboard author.
author_name
string
Name 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
DEPRECATED: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.
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.
reflow_type
enum
Reflow type for a new dashboard layout dashboard. Set this only when layout type is 'ordered'.
If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto',
widgets should not have layouts.
Allowed enum values: auto,fixed
restricted_roles
[string]
A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
tags
[string]
List of team names representing ownership of a 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
DEPRECATED: (deprecated) The value of the template variable within the saved view. Cannot be used in conjunction with values
.
values
[string]
One or many template variable values within the saved view, which will be unioned together using OR
if more than one is specified. Cannot be used in conjunction with value
.
template_variables
[object]
List of template variables for this dashboard.
available_values
[string]
The list of values that the template variable drop-down is limited to.
default
string
DEPRECATED: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with defaults
.
defaults
[string]
One or many default values for template variables on load. If more than one default is specified, they will be unioned together with OR
. Cannot be used in conjunction with default
.
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
or new dashboard layout dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
is_column_break
boolean
Whether the widget should be the first one on the second column in high density or not.
Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true
.
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.
{
"title": "Example-Dashboard",
"widgets": [
{
"definition": {
"title": "Example Cloud Cost Query",
"title_size": "16",
"title_align": "left",
"type": "timeseries",
"requests": [
{
"formulas": [
{
"formula": "query1"
}
],
"queries": [
{
"data_source": "cloud_cost",
"name": "query1",
"query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)"
}
],
"response_format": "timeseries",
"style": {
"palette": "dog_classic",
"line_type": "solid",
"line_width": "normal"
},
"display_type": "bars"
}
],
"time": {}
}
}
],
"layout_type": "ordered"
}
{
"title": "Example-Dashboard",
"description": "",
"widgets": [
{
"definition": {
"title": "APM Stats - Request latency HOP",
"title_size": "16",
"title_align": "left",
"show_legend": false,
"type": "distribution",
"xaxis": {
"max": "auto",
"include_zero": true,
"scale": "linear",
"min": "auto"
},
"yaxis": {
"max": "auto",
"include_zero": true,
"scale": "linear",
"min": "auto"
},
"requests": [
{
"query": {
"primary_tag_value": "*",
"stat": "latency_distribution",
"data_source": "apm_resource_stats",
"name": "query1",
"service": "azure-bill-import",
"group_by": [
"resource_name"
],
"env": "staging",
"primary_tag_name": "datacenter",
"operation_name": "universal.http.client"
},
"request_type": "histogram",
"style": {
"palette": "dog_classic"
}
}
]
},
"layout": {
"x": 8,
"y": 0,
"width": 4,
"height": 2
}
}
],
"layout_type": "ordered"
}
{
"title": "Example-Dashboard",
"description": "Example-Dashboard",
"widgets": [
{
"definition": {
"title": "Events Platform - Request latency HOP",
"title_size": "16",
"title_align": "left",
"show_legend": false,
"type": "distribution",
"xaxis": {
"max": "auto",
"include_zero": true,
"scale": "linear",
"min": "auto"
},
"yaxis": {
"max": "auto",
"include_zero": true,
"scale": "linear",
"min": "auto"
},
"requests": [
{
"query": {
"search": {
"query": ""
},
"data_source": "events",
"compute": {
"metric": "@duration",
"aggregation": "min"
},
"name": "query1",
"indexes": [
"*"
],
"group_by": []
},
"request_type": "histogram"
}
]
},
"layout": {
"x": 0,
"y": 0,
"width": 4,
"height": 2
}
}
],
"layout_type": "ordered"
}
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.
항목
유형
설명
author_handle
string
Identifier of the dashboard author.
author_name
string
Name 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
DEPRECATED: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.
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.
reflow_type
enum
Reflow type for a new dashboard layout dashboard. Set this only when layout type is 'ordered'.
If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto',
widgets should not have layouts.
Allowed enum values: auto,fixed
restricted_roles
[string]
A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
tags
[string]
List of team names representing ownership of a 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
DEPRECATED: (deprecated) The value of the template variable within the saved view. Cannot be used in conjunction with values
.
values
[string]
One or many template variable values within the saved view, which will be unioned together using OR
if more than one is specified. Cannot be used in conjunction with value
.
template_variables
[object]
List of template variables for this dashboard.
available_values
[string]
The list of values that the template variable drop-down is limited to.
default
string
DEPRECATED: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with defaults
.
defaults
[string]
One or many default values for template variables on load. If more than one default is specified, they will be unioned together with OR
. Cannot be used in conjunction with default
.
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
or new dashboard layout dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
is_column_break
boolean
Whether the widget should be the first one on the second column in high density or not.
Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true
.
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",
"author_name": "John Doe",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "123-abc-456",
"is_read_only": false,
"layout_type": "ordered",
"modified_at": "2019-09-19T10:00:00.000Z",
"notify_list": [],
"reflow_type": "string",
"restricted_roles": [],
"tags": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string",
"values": []
}
]
}
],
"template_variables": [
{
"available_values": [
"my-host",
"host1",
"host2"
],
"default": "my-host",
"defaults": [
"my-host-1",
"my-host-2"
],
"name": "host1",
"prefix": "host"
}
],
"title": "",
"url": "/dashboard/123-abc-456/example-dashboard-title",
"widgets": [
{
"definition": {
"requests": {
"fill": {
"q": "avg:system.cpu.user{*}"
}
},
"type": "hostmap"
},
"id": "integer",
"layout": {
"height": 0,
"is_column_break": false,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Clients deserialize a dashboard with a empty time object
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.Dashboard{
Title: "Example-Dashboard",
Widgets: []datadogV1.Widget{
{
Definition: datadogV1.WidgetDefinition{
TimeseriesWidgetDefinition: &datadogV1.TimeseriesWidgetDefinition{
Title: datadog.PtrString("Example Cloud Cost Query"),
TitleSize: datadog.PtrString("16"),
TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(),
Type: datadogV1.TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES,
Requests: []datadogV1.TimeseriesWidgetRequest{
{
Formulas: []datadogV1.WidgetFormula{
{
Formula: "query1",
},
},
Queries: []datadogV1.FormulaAndFunctionQueryDefinition{
datadogV1.FormulaAndFunctionQueryDefinition{
FormulaAndFunctionCloudCostQueryDefinition: &datadogV1.FormulaAndFunctionCloudCostQueryDefinition{
DataSource: datadogV1.FORMULAANDFUNCTIONCLOUDCOSTDATASOURCE_CLOUD_COST,
Name: "query1",
Query: "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
}},
},
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
Style: &datadogV1.WidgetRequestStyle{
Palette: datadog.PtrString("dog_classic"),
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),
},
DisplayType: datadogV1.WIDGETDISPLAYTYPE_BARS.Ptr(),
},
},
Time: &datadogV1.WidgetTime{
WidgetLegacyLiveSpan: &datadogV1.WidgetLegacyLiveSpan{}},
}},
},
},
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.CreateDashboard(ctx, body)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent)
}
// Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.Dashboard{
Title: "Example-Dashboard",
Description: *datadog.NewNullableString(datadog.PtrString("")),
Widgets: []datadogV1.Widget{
{
Definition: datadogV1.WidgetDefinition{
DistributionWidgetDefinition: &datadogV1.DistributionWidgetDefinition{
Title: datadog.PtrString("APM Stats - Request latency HOP"),
TitleSize: datadog.PtrString("16"),
TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(),
ShowLegend: datadog.PtrBool(false),
Type: datadogV1.DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION,
Xaxis: &datadogV1.DistributionWidgetXAxis{
Max: datadog.PtrString("auto"),
IncludeZero: datadog.PtrBool(true),
Scale: datadog.PtrString("linear"),
Min: datadog.PtrString("auto"),
},
Yaxis: &datadogV1.DistributionWidgetYAxis{
Max: datadog.PtrString("auto"),
IncludeZero: datadog.PtrBool(true),
Scale: datadog.PtrString("linear"),
Min: datadog.PtrString("auto"),
},
Requests: []datadogV1.DistributionWidgetRequest{
{
Query: &datadogV1.DistributionWidgetHistogramRequestQuery{
FormulaAndFunctionApmResourceStatsQueryDefinition: &datadogV1.FormulaAndFunctionApmResourceStatsQueryDefinition{
PrimaryTagValue: datadog.PtrString("*"),
Stat: datadogV1.FORMULAANDFUNCTIONAPMRESOURCESTATNAME_LATENCY_DISTRIBUTION,
DataSource: datadogV1.FORMULAANDFUNCTIONAPMRESOURCESTATSDATASOURCE_APM_RESOURCE_STATS,
Name: "query1",
Service: "azure-bill-import",
GroupBy: []string{
"resource_name",
},
Env: "staging",
PrimaryTagName: datadog.PtrString("datacenter"),
OperationName: datadog.PtrString("universal.http.client"),
}},
RequestType: datadogV1.DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM.Ptr(),
Style: &datadogV1.WidgetStyle{
Palette: datadog.PtrString("dog_classic"),
},
},
},
}},
Layout: &datadogV1.WidgetLayout{
X: 8,
Y: 0,
Width: 4,
Height: 2,
},
},
},
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.CreateDashboard(ctx, body)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent)
}
// Create a distribution widget using a histogram request containing a formulas and functions events query
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
body := datadogV1.Dashboard{
Title: "Example-Dashboard",
Description: *datadog.NewNullableString(datadog.PtrString("Example-Dashboard")),
Widgets: []datadogV1.Widget{
{
Definition: datadogV1.WidgetDefinition{
DistributionWidgetDefinition: &datadogV1.DistributionWidgetDefinition{
Title: datadog.PtrString("Events Platform - Request latency HOP"),
TitleSize: datadog.PtrString("16"),
TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(),
ShowLegend: datadog.PtrBool(false),
Type: datadogV1.DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION,
Xaxis: &datadogV1.DistributionWidgetXAxis{
Max: datadog.PtrString("auto"),
IncludeZero: datadog.PtrBool(true),
Scale: datadog.PtrString("linear"),
Min: datadog.PtrString("auto"),
},
Yaxis: &datadogV1.DistributionWidgetYAxis{
Max: datadog.PtrString("auto"),
IncludeZero: datadog.PtrBool(true),
Scale: datadog.PtrString("linear"),
Min: datadog.PtrString("auto"),
},
Requests: []datadogV1.DistributionWidgetRequest{
{
Query: &datadogV1.DistributionWidgetHistogramRequestQuery{
FormulaAndFunctionEventQueryDefinition: &datadogV1.FormulaAndFunctionEventQueryDefinition{
Search: &datadogV1.FormulaAndFunctionEventQueryDefinitionSearch{
Query: "",
},
DataSource: datadogV1.FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS,
Compute: datadogV1.FormulaAndFunctionEventQueryDefinitionCompute{
Metric: datadog.PtrString("@duration"),
Aggregation: datadogV1.FORMULAANDFUNCTIONEVENTAGGREGATION_MIN,
},
Name: "query1",
Indexes: []string{
"*",
},
GroupBy: []datadogV1.FormulaAndFunctionEventQueryGroupBy{},
}},
RequestType: datadogV1.DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM.Ptr(),
},
},
}},
Layout: &datadogV1.WidgetLayout{
X: 0,
Y: 0,
Width: 4,
Height: 2,
},
},
},
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.CreateDashboard(ctx, body)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
GET https://api.ap1.datadoghq.com/api/v1/dashboard/{dashboard_id}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}https://api.us5.datadoghq.com/api/v1/dashboard/{dashboard_id}
Get a dashboard using the specified ID.
This endpoint requires the dashboards_read
permission.
OAuth apps require the dashboards_read
authorization scope to access this endpoint.
이름
유형
설명
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.
항목
유형
설명
author_handle
string
Identifier of the dashboard author.
author_name
string
Name 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
DEPRECATED: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.
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.
reflow_type
enum
Reflow type for a new dashboard layout dashboard. Set this only when layout type is 'ordered'.
If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto',
widgets should not have layouts.
Allowed enum values: auto,fixed
restricted_roles
[string]
A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
tags
[string]
List of team names representing ownership of a 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
DEPRECATED: (deprecated) The value of the template variable within the saved view. Cannot be used in conjunction with values
.
values
[string]
One or many template variable values within the saved view, which will be unioned together using OR
if more than one is specified. Cannot be used in conjunction with value
.
template_variables
[object]
List of template variables for this dashboard.
available_values
[string]
The list of values that the template variable drop-down is limited to.
default
string
DEPRECATED: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with defaults
.
defaults
[string]
One or many default values for template variables on load. If more than one default is specified, they will be unioned together with OR
. Cannot be used in conjunction with default
.
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
or new dashboard layout dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
is_column_break
boolean
Whether the widget should be the first one on the second column in high density or not.
Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true
.
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",
"author_name": "John Doe",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "123-abc-456",
"is_read_only": false,
"layout_type": "ordered",
"modified_at": "2019-09-19T10:00:00.000Z",
"notify_list": [],
"reflow_type": "string",
"restricted_roles": [],
"tags": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string",
"values": []
}
]
}
],
"template_variables": [
{
"available_values": [
"my-host",
"host1",
"host2"
],
"default": "my-host",
"defaults": [
"my-host-1",
"my-host-2"
],
"name": "host1",
"prefix": "host"
}
],
"title": "",
"url": "/dashboard/123-abc-456/example-dashboard-title",
"widgets": [
{
"definition": {
"requests": {
"fill": {
"q": "avg:system.cpu.user{*}"
}
},
"type": "hostmap"
},
"id": "integer",
"layout": {
"height": 0,
"is_column_break": false,
"width": 0,
"x": 0,
"y": 0
}
}
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Item Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Get a dashboard returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
// there is a valid "dashboard" in the system
DashboardID := os.Getenv("DASHBOARD_ID")
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.GetDashboard(ctx, DashboardID)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.GetDashboard`:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
GET https://api.ap1.datadoghq.com/api/v1/dashboardhttps://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/dashboardhttps://api.us5.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.
This endpoint requires thedashboards_read
permission.OAuth apps require the dashboards_read
authorization scope to access this endpoint.
이름
유형
설명
filter[shared]
boolean
When true
, this query only returns shared custom created
or cloned dashboards.
filter[deleted]
boolean
When true
, this query returns only deleted custom-created
or cloned dashboards. This parameter is incompatible with filter[shared]
.
count
integer
The maximum number of dashboards returned in the list.
start
integer
The specific offset to use as the beginning of the returned response.
OK
Dashboard summary response.
항목
유형
설명
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
DEPRECATED: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.
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": "ordered",
"modified_at": "2019-09-19T10:00:00.000Z",
"title": "string",
"url": "string"
}
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Get all dashboards returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.ListDashboards(ctx, *datadogV1.NewListDashboardsOptionalParameters().WithFilterShared(false))
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.ListDashboards`:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
PUT https://api.ap1.datadoghq.com/api/v1/dashboard/{dashboard_id}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}https://api.us5.datadoghq.com/api/v1/dashboard/{dashboard_id}
Update a dashboard using the specified ID.
This endpoint requires the dashboards_write
permission.
OAuth apps require the dashboards_write
authorization scope to access this endpoint.
이름
유형
설명
dashboard_id [required]
string
The ID of the dashboard.
Update Dashboard request body.
항목
유형
설명
author_handle
string
Identifier of the dashboard author.
author_name
string
Name 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
DEPRECATED: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.
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.
reflow_type
enum
Reflow type for a new dashboard layout dashboard. Set this only when layout type is 'ordered'.
If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto',
widgets should not have layouts.
Allowed enum values: auto,fixed
restricted_roles
[string]
A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
tags
[string]
List of team names representing ownership of a 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
DEPRECATED: (deprecated) The value of the template variable within the saved view. Cannot be used in conjunction with values
.
values
[string]
One or many template variable values within the saved view, which will be unioned together using OR
if more than one is specified. Cannot be used in conjunction with value
.
template_variables
[object]
List of template variables for this dashboard.
available_values
[string]
The list of values that the template variable drop-down is limited to.
default
string
DEPRECATED: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with defaults
.
defaults
[string]
One or many default values for template variables on load. If more than one default is specified, they will be unioned together with OR
. Cannot be used in conjunction with default
.
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
or new dashboard layout dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
is_column_break
boolean
Whether the widget should be the first one on the second column in high density or not.
Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true
.
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.
{
"layout_type": "ordered",
"title": "Example-Dashboard with list_stream widget",
"description": "Updated description",
"widgets": [
{
"definition": {
"type": "list_stream",
"requests": [
{
"columns": [
{
"width": "auto",
"field": "timestamp"
}
],
"query": {
"data_source": "apm_issue_stream",
"query_string": ""
},
"response_format": "event_list"
}
]
}
}
]
}
{
"layout_type": "ordered",
"title": "Example-Dashboard with list_stream widget",
"description": "Updated description",
"tags": [
"team:foo",
"team:bar"
],
"widgets": [
{
"definition": {
"type": "list_stream",
"requests": [
{
"columns": [
{
"width": "auto",
"field": "timestamp"
}
],
"query": {
"data_source": "apm_issue_stream",
"query_string": ""
},
"response_format": "event_list"
}
]
}
}
]
}
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.
항목
유형
설명
author_handle
string
Identifier of the dashboard author.
author_name
string
Name 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
DEPRECATED: Whether this dashboard is read-only. If True, only the author and admins can make changes to it.
This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.
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.
reflow_type
enum
Reflow type for a new dashboard layout dashboard. Set this only when layout type is 'ordered'.
If set to 'fixed', the dashboard expects all widgets to have a layout, and if it's set to 'auto',
widgets should not have layouts.
Allowed enum values: auto,fixed
restricted_roles
[string]
A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
tags
[string]
List of team names representing ownership of a 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
DEPRECATED: (deprecated) The value of the template variable within the saved view. Cannot be used in conjunction with values
.
values
[string]
One or many template variable values within the saved view, which will be unioned together using OR
if more than one is specified. Cannot be used in conjunction with value
.
template_variables
[object]
List of template variables for this dashboard.
available_values
[string]
The list of values that the template variable drop-down is limited to.
default
string
DEPRECATED: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with defaults
.
defaults
[string]
One or many default values for template variables on load. If more than one default is specified, they will be unioned together with OR
. Cannot be used in conjunction with default
.
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
or new dashboard layout dashboard.
height [required]
int64
The height of the widget. Should be a non-negative integer.
is_column_break
boolean
Whether the widget should be the first one on the second column in high density or not.
Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true
.
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",
"author_name": "John Doe",
"created_at": "2019-09-19T10:00:00.000Z",
"description": "string",
"id": "123-abc-456",
"is_read_only": false,
"layout_type": "ordered",
"modified_at": "2019-09-19T10:00:00.000Z",
"notify_list": [],
"reflow_type": "string",
"restricted_roles": [],
"tags": [],
"template_variable_presets": [
{
"name": "string",
"template_variables": [
{
"name": "string",
"value": "string",
"values": []
}
]
}
],
"template_variables": [
{
"available_values": [
"my-host",
"host1",
"host2"
],
"default": "my-host",
"defaults": [
"my-host-1",
"my-host-2"
],
"name": "host1",
"prefix": "host"
}
],
"title": "",
"url": "/dashboard/123-abc-456/example-dashboard-title",
"widgets": [
{
"definition": {
"requests": {
"fill": {
"q": "avg:system.cpu.user{*}"
}
},
"type": "hostmap"
},
"id": "integer",
"layout": {
"height": 0,
"is_column_break": false,
"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"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Update a dashboard returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
// there is a valid "dashboard" in the system
DashboardID := os.Getenv("DASHBOARD_ID")
body := datadogV1.Dashboard{
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
Title: "Example-Dashboard with list_stream widget",
Description: *datadog.NewNullableString(datadog.PtrString("Updated description")),
Widgets: []datadogV1.Widget{
{
Definition: datadogV1.WidgetDefinition{
ListStreamWidgetDefinition: &datadogV1.ListStreamWidgetDefinition{
Type: datadogV1.LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM,
Requests: []datadogV1.ListStreamWidgetRequest{
{
Columns: []datadogV1.ListStreamColumn{
{
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
Field: "timestamp",
},
},
Query: datadogV1.ListStreamQuery{
DataSource: datadogV1.LISTSTREAMSOURCE_APM_ISSUE_STREAM,
QueryString: "",
},
ResponseFormat: datadogV1.LISTSTREAMRESPONSEFORMAT_EVENT_LIST,
},
},
}},
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.UpdateDashboard(ctx, DashboardID, body)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.UpdateDashboard`:\n%s\n", responseContent)
}
// Update a dashboard with tags returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
// there is a valid "dashboard" in the system
DashboardID := os.Getenv("DASHBOARD_ID")
body := datadogV1.Dashboard{
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
Title: "Example-Dashboard with list_stream widget",
Description: *datadog.NewNullableString(datadog.PtrString("Updated description")),
Tags: *datadog.NewNullableList(&[]string{
"team:foo",
"team:bar",
}),
Widgets: []datadogV1.Widget{
{
Definition: datadogV1.WidgetDefinition{
ListStreamWidgetDefinition: &datadogV1.ListStreamWidgetDefinition{
Type: datadogV1.LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM,
Requests: []datadogV1.ListStreamWidgetRequest{
{
Columns: []datadogV1.ListStreamColumn{
{
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO,
Field: "timestamp",
},
},
Query: datadogV1.ListStreamQuery{
DataSource: datadogV1.LISTSTREAMSOURCE_APM_ISSUE_STREAM,
QueryString: "",
},
ResponseFormat: datadogV1.LISTSTREAMRESPONSEFORMAT_EVENT_LIST,
},
},
}},
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.UpdateDashboard(ctx, DashboardID, body)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.UpdateDashboard`:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
DELETE https://api.ap1.datadoghq.com/api/v1/dashboard/{dashboard_id}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}https://api.us5.datadoghq.com/api/v1/dashboard/{dashboard_id}
Delete a dashboard using the specified ID.
This endpoint requires the dashboards_write
permission.
OAuth apps require the dashboards_write
authorization scope to access this endpoint.
이름
유형
설명
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"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Delete a dashboard returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
// there is a valid "dashboard" in the system
DashboardID := os.Getenv("DASHBOARD_ID")
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
resp, r, err := api.DeleteDashboard(ctx, DashboardID)
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)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.DeleteDashboard`:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
DELETE https://api.ap1.datadoghq.com/api/v1/dashboardhttps://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/dashboardhttps://api.us5.datadoghq.com/api/v1/dashboard
Delete dashboards using the specified IDs. If there are any failures, no dashboards will be deleted (partial success is not allowed).
This endpoint requires the dashboards_write
permission.
OAuth apps require the dashboards_write
authorization scope to access this endpoint.
Delete dashboards request body.
항목
유형
설명
data [required]
[object]
List of dashboard bulk action request data objects.
id [required]
string
Dashboard resource ID.
type [required]
enum
Dashboard resource type.
Allowed enum values: dashboard
default: dashboard
{
"data": [
{
"id": "123-abc-456",
"type": "dashboard"
}
]
}
No Content
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
Dashboards Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Delete dashboards returns "No Content" response
package main
import (
"context"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
// there is a valid "dashboard" in the system
DashboardID := os.Getenv("DASHBOARD_ID")
body := datadogV1.DashboardBulkDeleteRequest{
Data: []datadogV1.DashboardBulkActionData{
{
Id: DashboardID,
Type: datadogV1.DASHBOARDRESOURCETYPE_DASHBOARD,
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
r, err := api.DeleteDashboards(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.DeleteDashboards`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
PATCH https://api.ap1.datadoghq.com/api/v1/dashboardhttps://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/dashboardhttps://api.us5.datadoghq.com/api/v1/dashboard
Restore dashboards using the specified IDs. If there are any failures, no dashboards will be restored (partial success is not allowed).
This endpoint requires the dashboards_write
permission.
OAuth apps require the dashboards_write
authorization scope to access this endpoint.
Restore dashboards request body.
항목
유형
설명
data [required]
[object]
List of dashboard bulk action request data objects.
id [required]
string
Dashboard resource ID.
type [required]
enum
Dashboard resource type.
Allowed enum values: dashboard
default: dashboard
{
"data": [
{
"id": "123-abc-456",
"type": "dashboard"
}
]
}
No Content
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Forbidden
Error response object.
{
"errors": [
"Bad Request"
]
}
Dashboards Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
Too many requests
Error response object.
{
"errors": [
"Bad Request"
]
}
// Restore deleted dashboards returns "No Content" response
package main
import (
"context"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)
func main() {
// there is a valid "dashboard" in the system
DashboardID := os.Getenv("DASHBOARD_ID")
body := datadogV1.DashboardRestoreRequest{
Data: []datadogV1.DashboardBulkActionData{
{
Id: DashboardID,
Type: datadogV1.DASHBOARDRESOURCETYPE_DASHBOARD,
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV1.NewDashboardsApi(apiClient)
r, err := api.RestoreDashboards(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.RestoreDashboards`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"