Dashboards

Gérez tous vos dashboards, ainsi que l’accès à vos dashboards partagés, par le biais de l’API. Consultez la page relative aux [dashboards]](https://docs.datadoghq.com/dashboards/) pour en savoir plus.

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

Présentation

Créez un dashboard avec les options spécifiées. Lorsque vous définissez des requêtes dans vos widgets, repérez les requêtes pour lesquelles il faut ajouter les modificateurs as_count() ou as_rate(). Consultez la [documentation relative aux modificateurs intégrés à l’application] (https://docs.datadoghq.com/developers/metrics/type_modifiers/?tab=count#modificateurs-integres-a-l-application) pour en savoir plus. This endpoint requires the dashboards_write permission.

OAuth apps require the dashboards_write authorization scope to access this endpoint.

Requête

Body Data (required)

Corps de requête pour la création d’un dashboard.

Expand All

Champ

Type

Description

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]

DEPRECATED: A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.

This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.

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.

definition [required]

 <oneOf>

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

Réponse

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

Champ

Type

Description

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]

DEPRECATED: A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.

This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.

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.

definition [required]

 <oneOf>

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.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "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" } EOF
                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "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" } EOF
                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "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" } EOF
// 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)
}
// Create a distribution widget using a histogram request containing a formulas and functions metrics 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",
		Widgets: []datadogV1.Widget{
			{
				Definition: datadogV1.WidgetDefinition{
					DistributionWidgetDefinition: &datadogV1.DistributionWidgetDefinition{
						Title:      datadog.PtrString("Metrics HOP"),
						TitleSize:  datadog.PtrString("16"),
						TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(),
						ShowLegend: datadog.PtrBool(false),
						Type:       datadogV1.DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION,
						CustomLinks: []datadogV1.WidgetCustomLink{
							{
								Label: datadog.PtrString("Example"),
								Link:  datadog.PtrString("https://example.org/"),
							},
						},
						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{
									FormulaAndFunctionMetricQueryDefinition: &datadogV1.FormulaAndFunctionMetricQueryDefinition{
										Query:      "histogram:trace.Load{*}",
										DataSource: datadogV1.FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS,
										Name:       "query1",
									}},
								RequestType: datadogV1.DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM.Ptr(),
								Style: &datadogV1.WidgetStyle{
									Palette: datadog.PtrString("dog_classic"),
								},
							},
						},
					}},
				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)
}

Instructions

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"
// Create a distribution widget using a histogram request containing a formulas and functions APM
// Stats query

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.DistributionWidgetDefinition;
import com.datadog.api.client.v1.model.DistributionWidgetDefinitionType;
import com.datadog.api.client.v1.model.DistributionWidgetHistogramRequestQuery;
import com.datadog.api.client.v1.model.DistributionWidgetHistogramRequestType;
import com.datadog.api.client.v1.model.DistributionWidgetRequest;
import com.datadog.api.client.v1.model.DistributionWidgetXAxis;
import com.datadog.api.client.v1.model.DistributionWidgetYAxis;
import com.datadog.api.client.v1.model.FormulaAndFunctionApmResourceStatName;
import com.datadog.api.client.v1.model.FormulaAndFunctionApmResourceStatsDataSource;
import com.datadog.api.client.v1.model.FormulaAndFunctionApmResourceStatsQueryDefinition;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetLayout;
import com.datadog.api.client.v1.model.WidgetStyle;
import com.datadog.api.client.v1.model.WidgetTextAlign;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    Dashboard body =
        new Dashboard()
            .title("Example-Dashboard")
            .description("")
            .widgets(
                Collections.singletonList(
                    new Widget()
                        .definition(
                            new WidgetDefinition(
                                new DistributionWidgetDefinition()
                                    .title("APM Stats - Request latency HOP")
                                    .titleSize("16")
                                    .titleAlign(WidgetTextAlign.LEFT)
                                    .showLegend(false)
                                    .type(DistributionWidgetDefinitionType.DISTRIBUTION)
                                    .xaxis(
                                        new DistributionWidgetXAxis()
                                            .max("auto")
                                            .includeZero(true)
                                            .scale("linear")
                                            .min("auto"))
                                    .yaxis(
                                        new DistributionWidgetYAxis()
                                            .max("auto")
                                            .includeZero(true)
                                            .scale("linear")
                                            .min("auto"))
                                    .requests(
                                        Collections.singletonList(
                                            new DistributionWidgetRequest()
                                                .query(
                                                    new DistributionWidgetHistogramRequestQuery(
                                                        new FormulaAndFunctionApmResourceStatsQueryDefinition()
                                                            .primaryTagValue("*")
                                                            .stat(
                                                                FormulaAndFunctionApmResourceStatName
                                                                    .LATENCY_DISTRIBUTION)
                                                            .dataSource(
                                                                FormulaAndFunctionApmResourceStatsDataSource
                                                                    .APM_RESOURCE_STATS)
                                                            .name("query1")
                                                            .service("azure-bill-import")
                                                            .groupBy(
                                                                Collections.singletonList(
                                                                    "resource_name"))
                                                            .env("staging")
                                                            .primaryTagName("datacenter")
                                                            .operationName(
                                                                "universal.http.client")))
                                                .requestType(
                                                    DistributionWidgetHistogramRequestType
                                                        .HISTOGRAM)
                                                .style(new WidgetStyle().palette("dog_classic"))))))
                        .layout(new WidgetLayout().x(8L).y(0L).width(4L).height(2L))))
            .layoutType(DashboardLayoutType.ORDERED);

    try {
      Dashboard result = apiInstance.createDashboard(body);
      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();
    }
  }
}
// Create a distribution widget using a histogram request containing a formulas and functions events
// query

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.DistributionWidgetDefinition;
import com.datadog.api.client.v1.model.DistributionWidgetDefinitionType;
import com.datadog.api.client.v1.model.DistributionWidgetHistogramRequestQuery;
import com.datadog.api.client.v1.model.DistributionWidgetHistogramRequestType;
import com.datadog.api.client.v1.model.DistributionWidgetRequest;
import com.datadog.api.client.v1.model.DistributionWidgetXAxis;
import com.datadog.api.client.v1.model.DistributionWidgetYAxis;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventAggregation;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventQueryDefinition;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventQueryDefinitionCompute;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventQueryDefinitionSearch;
import com.datadog.api.client.v1.model.FormulaAndFunctionEventsDataSource;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetLayout;
import com.datadog.api.client.v1.model.WidgetTextAlign;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    Dashboard body =
        new Dashboard()
            .title("Example-Dashboard")
            .description("Example-Dashboard")
            .widgets(
                Collections.singletonList(
                    new Widget()
                        .definition(
                            new WidgetDefinition(
                                new DistributionWidgetDefinition()
                                    .title("Events Platform - Request latency HOP")
                                    .titleSize("16")
                                    .titleAlign(WidgetTextAlign.LEFT)
                                    .showLegend(false)
                                    .type(DistributionWidgetDefinitionType.DISTRIBUTION)
                                    .xaxis(
                                        new DistributionWidgetXAxis()
                                            .max("auto")
                                            .includeZero(true)
                                            .scale("linear")
                                            .min("auto"))
                                    .yaxis(
                                        new DistributionWidgetYAxis()
                                            .max("auto")
                                            .includeZero(true)
                                            .scale("linear")
                                            .min("auto"))
                                    .requests(
                                        Collections.singletonList(
                                            new DistributionWidgetRequest()
                                                .query(
                                                    new DistributionWidgetHistogramRequestQuery(
                                                        new FormulaAndFunctionEventQueryDefinition()
                                                            .search(
                                                                new FormulaAndFunctionEventQueryDefinitionSearch()
                                                                    .query(""))
                                                            .dataSource(
                                                                FormulaAndFunctionEventsDataSource
                                                                    .EVENTS)
                                                            .compute(
                                                                new FormulaAndFunctionEventQueryDefinitionCompute()
                                                                    .metric("@duration")
                                                                    .aggregation(
                                                                        FormulaAndFunctionEventAggregation
                                                                            .MIN))
                                                            .name("query1")
                                                            .indexes(
                                                                Collections.singletonList("*"))))
                                                .requestType(
                                                    DistributionWidgetHistogramRequestType
                                                        .HISTOGRAM)))))
                        .layout(new WidgetLayout().x(0L).y(0L).width(4L).height(2L))))
            .layoutType(DashboardLayoutType.ORDERED);

    try {
      Dashboard result = apiInstance.createDashboard(body);
      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();
    }
  }
}
// Create a distribution widget using a histogram request containing a formulas and functions
// metrics query

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.DistributionWidgetDefinition;
import com.datadog.api.client.v1.model.DistributionWidgetDefinitionType;
import com.datadog.api.client.v1.model.DistributionWidgetHistogramRequestQuery;
import com.datadog.api.client.v1.model.DistributionWidgetHistogramRequestType;
import com.datadog.api.client.v1.model.DistributionWidgetRequest;
import com.datadog.api.client.v1.model.DistributionWidgetXAxis;
import com.datadog.api.client.v1.model.DistributionWidgetYAxis;
import com.datadog.api.client.v1.model.FormulaAndFunctionMetricDataSource;
import com.datadog.api.client.v1.model.FormulaAndFunctionMetricQueryDefinition;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetCustomLink;
import com.datadog.api.client.v1.model.WidgetDefinition;
import com.datadog.api.client.v1.model.WidgetLayout;
import com.datadog.api.client.v1.model.WidgetStyle;
import com.datadog.api.client.v1.model.WidgetTextAlign;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    Dashboard body =
        new Dashboard()
            .title("Example-Dashboard")
            .widgets(
                Collections.singletonList(
                    new Widget()
                        .definition(
                            new WidgetDefinition(
                                new DistributionWidgetDefinition()
                                    .title("Metrics HOP")
                                    .titleSize("16")
                                    .titleAlign(WidgetTextAlign.LEFT)
                                    .showLegend(false)
                                    .type(DistributionWidgetDefinitionType.DISTRIBUTION)
                                    .customLinks(
                                        Collections.singletonList(
                                            new WidgetCustomLink()
                                                .label("Example")
                                                .link("https://example.org/")))
                                    .xaxis(
                                        new DistributionWidgetXAxis()
                                            .max("auto")
                                            .includeZero(true)
                                            .scale("linear")
                                            .min("auto"))
                                    .yaxis(
                                        new DistributionWidgetYAxis()
                                            .max("auto")
                                            .includeZero(true)
                                            .scale("linear")
                                            .min("auto"))
                                    .requests(
                                        Collections.singletonList(
                                            new DistributionWidgetRequest()
                                                .query(
                                                    new DistributionWidgetHistogramRequestQuery(
                                                        new FormulaAndFunctionMetricQueryDefinition()
                                                            .query("histogram:trace.Load{*}")
                                                            .dataSource(
                                                                FormulaAndFunctionMetricDataSource
                                                                    .METRICS)
                                                            .name("query1")))
                                                .requestType(
                                                    DistributionWidgetHistogramRequestType
                                                        .HISTOGRAM)
                                                .style(new WidgetStyle().palette("dog_classic"))))))
                        .layout(new WidgetLayout().x(0L).y(0L).width(4L).height(2L))))
            .layoutType(DashboardLayoutType.ORDERED);

    try {
      Dashboard result = apiInstance.createDashboard(body);
      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();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
from datadog import initialize, api

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

initialize(**options)

title = 'Average Memory Free Shell'
widgets = [{
    'definition': {
        'type': 'timeseries',
        'requests': [
            {'q': 'avg:system.mem.free{*}'}
        ],
        'title': 'Average Memory Free'
    }
}]
layout_type = 'ordered'
description = 'A dashboard with memory info.'
is_read_only = True
notify_list = ['user@domain.com']
template_variables = [{
    'name': 'host1',
    'prefix': 'host',
    'default': 'my-host'
}]

saved_views = [{
    'name': 'Saved views for hostname 2',
    'template_variables': [{'name': 'host', 'value': '<HOSTNAME_2>'}]}
]

api.Dashboard.create(title=title,
                     widgets=widgets,
                     layout_type=layout_type,
                     description=description,
                     is_read_only=is_read_only,
                     notify_list=notify_list,
                     template_variables=template_variables,
                     template_variable_presets=saved_view)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python "example.py"
"""
Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.distribution_widget_definition import DistributionWidgetDefinition
from datadog_api_client.v1.model.distribution_widget_definition_type import DistributionWidgetDefinitionType
from datadog_api_client.v1.model.distribution_widget_histogram_request_type import (
    DistributionWidgetHistogramRequestType,
)
from datadog_api_client.v1.model.distribution_widget_request import DistributionWidgetRequest
from datadog_api_client.v1.model.distribution_widget_x_axis import DistributionWidgetXAxis
from datadog_api_client.v1.model.distribution_widget_y_axis import DistributionWidgetYAxis
from datadog_api_client.v1.model.formula_and_function_apm_resource_stat_name import (
    FormulaAndFunctionApmResourceStatName,
)
from datadog_api_client.v1.model.formula_and_function_apm_resource_stats_data_source import (
    FormulaAndFunctionApmResourceStatsDataSource,
)
from datadog_api_client.v1.model.formula_and_function_apm_resource_stats_query_definition import (
    FormulaAndFunctionApmResourceStatsQueryDefinition,
)
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_style import WidgetStyle
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign

body = Dashboard(
    title="Example-Dashboard",
    description="",
    widgets=[
        Widget(
            definition=DistributionWidgetDefinition(
                title="APM Stats - Request latency HOP",
                title_size="16",
                title_align=WidgetTextAlign.LEFT,
                show_legend=False,
                type=DistributionWidgetDefinitionType.DISTRIBUTION,
                xaxis=DistributionWidgetXAxis(
                    max="auto",
                    include_zero=True,
                    scale="linear",
                    min="auto",
                ),
                yaxis=DistributionWidgetYAxis(
                    max="auto",
                    include_zero=True,
                    scale="linear",
                    min="auto",
                ),
                requests=[
                    DistributionWidgetRequest(
                        query=FormulaAndFunctionApmResourceStatsQueryDefinition(
                            primary_tag_value="*",
                            stat=FormulaAndFunctionApmResourceStatName.LATENCY_DISTRIBUTION,
                            data_source=FormulaAndFunctionApmResourceStatsDataSource.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=DistributionWidgetHistogramRequestType.HISTOGRAM,
                        style=WidgetStyle(
                            palette="dog_classic",
                        ),
                    ),
                ],
            ),
            layout=WidgetLayout(
                x=8,
                y=0,
                width=4,
                height=2,
            ),
        ),
    ],
    layout_type=DashboardLayoutType.ORDERED,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.create_dashboard(body=body)

    print(response)
"""
Create a distribution widget using a histogram request containing a formulas and functions events query
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.distribution_widget_definition import DistributionWidgetDefinition
from datadog_api_client.v1.model.distribution_widget_definition_type import DistributionWidgetDefinitionType
from datadog_api_client.v1.model.distribution_widget_histogram_request_type import (
    DistributionWidgetHistogramRequestType,
)
from datadog_api_client.v1.model.distribution_widget_request import DistributionWidgetRequest
from datadog_api_client.v1.model.distribution_widget_x_axis import DistributionWidgetXAxis
from datadog_api_client.v1.model.distribution_widget_y_axis import DistributionWidgetYAxis
from datadog_api_client.v1.model.formula_and_function_event_aggregation import FormulaAndFunctionEventAggregation
from datadog_api_client.v1.model.formula_and_function_event_query_definition import (
    FormulaAndFunctionEventQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_event_query_definition_compute import (
    FormulaAndFunctionEventQueryDefinitionCompute,
)
from datadog_api_client.v1.model.formula_and_function_event_query_definition_search import (
    FormulaAndFunctionEventQueryDefinitionSearch,
)
from datadog_api_client.v1.model.formula_and_function_events_data_source import FormulaAndFunctionEventsDataSource
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign

body = Dashboard(
    title="Example-Dashboard",
    description="Example-Dashboard",
    widgets=[
        Widget(
            definition=DistributionWidgetDefinition(
                title="Events Platform - Request latency HOP",
                title_size="16",
                title_align=WidgetTextAlign.LEFT,
                show_legend=False,
                type=DistributionWidgetDefinitionType.DISTRIBUTION,
                xaxis=DistributionWidgetXAxis(
                    max="auto",
                    include_zero=True,
                    scale="linear",
                    min="auto",
                ),
                yaxis=DistributionWidgetYAxis(
                    max="auto",
                    include_zero=True,
                    scale="linear",
                    min="auto",
                ),
                requests=[
                    DistributionWidgetRequest(
                        query=FormulaAndFunctionEventQueryDefinition(
                            search=FormulaAndFunctionEventQueryDefinitionSearch(
                                query="",
                            ),
                            data_source=FormulaAndFunctionEventsDataSource.EVENTS,
                            compute=FormulaAndFunctionEventQueryDefinitionCompute(
                                metric="@duration",
                                aggregation=FormulaAndFunctionEventAggregation.MIN,
                            ),
                            name="query1",
                            indexes=[
                                "*",
                            ],
                            group_by=[],
                        ),
                        request_type=DistributionWidgetHistogramRequestType.HISTOGRAM,
                    ),
                ],
            ),
            layout=WidgetLayout(
                x=0,
                y=0,
                width=4,
                height=2,
            ),
        ),
    ],
    layout_type=DashboardLayoutType.ORDERED,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.create_dashboard(body=body)

    print(response)
"""
Create a distribution widget using a histogram request containing a formulas and functions metrics query
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.distribution_widget_definition import DistributionWidgetDefinition
from datadog_api_client.v1.model.distribution_widget_definition_type import DistributionWidgetDefinitionType
from datadog_api_client.v1.model.distribution_widget_histogram_request_type import (
    DistributionWidgetHistogramRequestType,
)
from datadog_api_client.v1.model.distribution_widget_request import DistributionWidgetRequest
from datadog_api_client.v1.model.distribution_widget_x_axis import DistributionWidgetXAxis
from datadog_api_client.v1.model.distribution_widget_y_axis import DistributionWidgetYAxis
from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource
from datadog_api_client.v1.model.formula_and_function_metric_query_definition import (
    FormulaAndFunctionMetricQueryDefinition,
)
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_style import WidgetStyle
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign

body = Dashboard(
    title="Example-Dashboard",
    widgets=[
        Widget(
            definition=DistributionWidgetDefinition(
                title="Metrics HOP",
                title_size="16",
                title_align=WidgetTextAlign.LEFT,
                show_legend=False,
                type=DistributionWidgetDefinitionType.DISTRIBUTION,
                custom_links=[
                    WidgetCustomLink(
                        label="Example",
                        link="https://example.org/",
                    ),
                ],
                xaxis=DistributionWidgetXAxis(
                    max="auto",
                    include_zero=True,
                    scale="linear",
                    min="auto",
                ),
                yaxis=DistributionWidgetYAxis(
                    max="auto",
                    include_zero=True,
                    scale="linear",
                    min="auto",
                ),
                requests=[
                    DistributionWidgetRequest(
                        query=FormulaAndFunctionMetricQueryDefinition(
                            query="histogram:trace.Load{*}",
                            data_source=FormulaAndFunctionMetricDataSource.METRICS,
                            name="query1",
                        ),
                        request_type=DistributionWidgetHistogramRequestType.HISTOGRAM,
                        style=WidgetStyle(
                            palette="dog_classic",
                        ),
                    ),
                ],
            ),
            layout=WidgetLayout(
                x=0,
                y=0,
                width=4,
                height=2,
            ),
        ),
    ],
    layout_type=DashboardLayoutType.ORDERED,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.create_dashboard(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

# Create a dashboard.
title = 'Average Memory Free Shell'
widgets = [{
    'definition': {
        'type' => 'timeseries',
        'requests' => [
            {'q' => 'avg:system.mem.free{*}'}
        ],
        'title' => 'Average Memory Free'
    }
}]
layout_type = 'ordered'
description = 'A dashboard with memory info.'
is_read_only = true
notify_list = ['user@domain.com']
template_variables = [{
    'name' => 'host',
    'prefix' => 'host',
    'default' => '<HOSTNAME_1>'
}]

saved_view = [{
  'name': 'Saved views for hostname 2',
  'template_variables': [{'name': 'host', 'value': '<HOSTNAME_2>'}]}
  ]

dog.create_board(title, widgets, layout_type, {
    :description => description,
    :is_read_only => is_read_only,
    :notify_list => notify_list,
    :template_variables => template_variables,
    :template_variable_presets => saved_view
    })

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
# Create a distribution widget using a histogram request containing a formulas and functions APM Stats query

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::Dashboard.new({
  title: "Example-Dashboard",
  description: "",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::DistributionWidgetDefinition.new({
        title: "APM Stats - Request latency HOP",
        title_size: "16",
        title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
        show_legend: false,
        type: DatadogAPIClient::V1::DistributionWidgetDefinitionType::DISTRIBUTION,
        xaxis: DatadogAPIClient::V1::DistributionWidgetXAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        yaxis: DatadogAPIClient::V1::DistributionWidgetYAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        requests: [
          DatadogAPIClient::V1::DistributionWidgetRequest.new({
            query: DatadogAPIClient::V1::FormulaAndFunctionApmResourceStatsQueryDefinition.new({
              primary_tag_value: "*",
              stat: DatadogAPIClient::V1::FormulaAndFunctionApmResourceStatName::LATENCY_DISTRIBUTION,
              data_source: DatadogAPIClient::V1::FormulaAndFunctionApmResourceStatsDataSource::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: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM,
            style: DatadogAPIClient::V1::WidgetStyle.new({
              palette: "dog_classic",
            }),
          }),
        ],
      }),
      layout: DatadogAPIClient::V1::WidgetLayout.new({
        x: 8,
        y: 0,
        width: 4,
        height: 2,
      }),
    }),
  ],
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
})
p api_instance.create_dashboard(body)
# Create a distribution widget using a histogram request containing a formulas and functions events query

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::Dashboard.new({
  title: "Example-Dashboard",
  description: "Example-Dashboard",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::DistributionWidgetDefinition.new({
        title: "Events Platform - Request latency HOP",
        title_size: "16",
        title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
        show_legend: false,
        type: DatadogAPIClient::V1::DistributionWidgetDefinitionType::DISTRIBUTION,
        xaxis: DatadogAPIClient::V1::DistributionWidgetXAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        yaxis: DatadogAPIClient::V1::DistributionWidgetYAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        requests: [
          DatadogAPIClient::V1::DistributionWidgetRequest.new({
            query: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinition.new({
              search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({
                query: "",
              }),
              data_source: DatadogAPIClient::V1::FormulaAndFunctionEventsDataSource::EVENTS,
              compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({
                metric: "@duration",
                aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::MIN,
              }),
              name: "query1",
              indexes: [
                "*",
              ],
              group_by: [],
            }),
            request_type: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM,
          }),
        ],
      }),
      layout: DatadogAPIClient::V1::WidgetLayout.new({
        x: 0,
        y: 0,
        width: 4,
        height: 2,
      }),
    }),
  ],
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
})
p api_instance.create_dashboard(body)
# Create a distribution widget using a histogram request containing a formulas and functions metrics query

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::Dashboard.new({
  title: "Example-Dashboard",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::DistributionWidgetDefinition.new({
        title: "Metrics HOP",
        title_size: "16",
        title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
        show_legend: false,
        type: DatadogAPIClient::V1::DistributionWidgetDefinitionType::DISTRIBUTION,
        custom_links: [
          DatadogAPIClient::V1::WidgetCustomLink.new({
            label: "Example",
            link: "https://example.org/",
          }),
        ],
        xaxis: DatadogAPIClient::V1::DistributionWidgetXAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        yaxis: DatadogAPIClient::V1::DistributionWidgetYAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        requests: [
          DatadogAPIClient::V1::DistributionWidgetRequest.new({
            query: DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
              query: "histogram:trace.Load{*}",
              data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
              name: "query1",
            }),
            request_type: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM,
            style: DatadogAPIClient::V1::WidgetStyle.new({
              palette: "dog_classic",
            }),
          }),
        ],
      }),
      layout: DatadogAPIClient::V1::WidgetLayout.new({
        x: 0,
        y: 0,
        width: 4,
        height: 2,
      }),
    }),
  ],
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
})
p api_instance.create_dashboard(body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Create a distribution widget using a histogram request containing a formulas
// and functions APM Stats query
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinition;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType;
use datadog_api_client::datadogV1::model::DistributionWidgetRequest;
use datadog_api_client::datadogV1::model::DistributionWidgetXAxis;
use datadog_api_client::datadogV1::model::DistributionWidgetYAxis;
use datadog_api_client::datadogV1::model::FormulaAndFunctionApmResourceStatName;
use datadog_api_client::datadogV1::model::FormulaAndFunctionApmResourceStatsDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionApmResourceStatsQueryDefinition;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetLayout;
use datadog_api_client::datadogV1::model::WidgetStyle;
use datadog_api_client::datadogV1::model::WidgetTextAlign;

#[tokio::main]
async fn main() {
    let body =
        Dashboard::new(
            DashboardLayoutType::ORDERED,
            "Example-Dashboard".to_string(),
            vec![
                Widget::new(
                    WidgetDefinition::DistributionWidgetDefinition(
                        Box::new(
                            DistributionWidgetDefinition::new(
                                vec![
                                    DistributionWidgetRequest::new()
                                        .query(
                                            DistributionWidgetHistogramRequestQuery
                                            ::FormulaAndFunctionApmResourceStatsQueryDefinition(
                                                Box::new(
                                                    FormulaAndFunctionApmResourceStatsQueryDefinition::new(
                                                        FormulaAndFunctionApmResourceStatsDataSource
                                                        ::APM_RESOURCE_STATS,
                                                        "staging".to_string(),
                                                        "query1".to_string(),
                                                        "azure-bill-import".to_string(),
                                                        FormulaAndFunctionApmResourceStatName::LATENCY_DISTRIBUTION,
                                                    )
                                                        .group_by(vec!["resource_name".to_string()])
                                                        .operation_name("universal.http.client".to_string())
                                                        .primary_tag_name("datacenter".to_string())
                                                        .primary_tag_value("*".to_string()),
                                                ),
                                            ),
                                        )
                                        .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
                                        .style(WidgetStyle::new().palette("dog_classic".to_string()))
                                ],
                                DistributionWidgetDefinitionType::DISTRIBUTION,
                            )
                                .show_legend(false)
                                .title("APM Stats - Request latency HOP".to_string())
                                .title_align(WidgetTextAlign::LEFT)
                                .title_size("16".to_string())
                                .xaxis(
                                    DistributionWidgetXAxis::new()
                                        .include_zero(true)
                                        .max("auto".to_string())
                                        .min("auto".to_string())
                                        .scale("linear".to_string()),
                                )
                                .yaxis(
                                    DistributionWidgetYAxis::new()
                                        .include_zero(true)
                                        .max("auto".to_string())
                                        .min("auto".to_string())
                                        .scale("linear".to_string()),
                                ),
                        ),
                    ),
                ).layout(WidgetLayout::new(2, 4, 8, 0))
            ],
        ).description(Some("".to_string()));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.create_dashboard(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
// Create a distribution widget using a histogram request containing a formulas
// and functions events query
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinition;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType;
use datadog_api_client::datadogV1::model::DistributionWidgetRequest;
use datadog_api_client::datadogV1::model::DistributionWidgetXAxis;
use datadog_api_client::datadogV1::model::DistributionWidgetYAxis;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetLayout;
use datadog_api_client::datadogV1::model::WidgetTextAlign;

#[tokio::main]
async fn main() {
    let body =
        Dashboard::new(
            DashboardLayoutType::ORDERED,
            "Example-Dashboard".to_string(),
            vec![
                Widget::new(
                    WidgetDefinition::DistributionWidgetDefinition(
                        Box::new(
                            DistributionWidgetDefinition::new(
                                vec![
                                    DistributionWidgetRequest::new()
                                        .query(
                                            DistributionWidgetHistogramRequestQuery
                                            ::FormulaAndFunctionEventQueryDefinition(
                                                Box::new(
                                                    FormulaAndFunctionEventQueryDefinition::new(
                                                        FormulaAndFunctionEventQueryDefinitionCompute::new(
                                                            FormulaAndFunctionEventAggregation::MIN,
                                                        ).metric("@duration".to_string()),
                                                        FormulaAndFunctionEventsDataSource::EVENTS,
                                                        "query1".to_string(),
                                                    )
                                                        .group_by(vec![])
                                                        .indexes(vec!["*".to_string()])
                                                        .search(
                                                            FormulaAndFunctionEventQueryDefinitionSearch::new(
                                                                "".to_string(),
                                                            ),
                                                        ),
                                                ),
                                            ),
                                        )
                                        .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
                                ],
                                DistributionWidgetDefinitionType::DISTRIBUTION,
                            )
                                .show_legend(false)
                                .title("Events Platform - Request latency HOP".to_string())
                                .title_align(WidgetTextAlign::LEFT)
                                .title_size("16".to_string())
                                .xaxis(
                                    DistributionWidgetXAxis::new()
                                        .include_zero(true)
                                        .max("auto".to_string())
                                        .min("auto".to_string())
                                        .scale("linear".to_string()),
                                )
                                .yaxis(
                                    DistributionWidgetYAxis::new()
                                        .include_zero(true)
                                        .max("auto".to_string())
                                        .min("auto".to_string())
                                        .scale("linear".to_string()),
                                ),
                        ),
                    ),
                ).layout(WidgetLayout::new(2, 4, 0, 0))
            ],
        ).description(Some("Example-Dashboard".to_string()));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.create_dashboard(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
// Create a distribution widget using a histogram request containing a formulas
// and functions metrics query
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinition;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType;
use datadog_api_client::datadogV1::model::DistributionWidgetRequest;
use datadog_api_client::datadogV1::model::DistributionWidgetXAxis;
use datadog_api_client::datadogV1::model::DistributionWidgetYAxis;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetCustomLink;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetLayout;
use datadog_api_client::datadogV1::model::WidgetStyle;
use datadog_api_client::datadogV1::model::WidgetTextAlign;

#[tokio::main]
async fn main() {
    let body =
        Dashboard::new(
            DashboardLayoutType::ORDERED,
            "Example-Dashboard".to_string(),
            vec![
                Widget::new(
                    WidgetDefinition::DistributionWidgetDefinition(
                        Box::new(
                            DistributionWidgetDefinition::new(
                                vec![
                                    DistributionWidgetRequest::new()
                                        .query(
                                            DistributionWidgetHistogramRequestQuery
                                            ::FormulaAndFunctionMetricQueryDefinition(
                                                Box::new(
                                                    FormulaAndFunctionMetricQueryDefinition::new(
                                                        FormulaAndFunctionMetricDataSource::METRICS,
                                                        "query1".to_string(),
                                                        "histogram:trace.Load{*}".to_string(),
                                                    ),
                                                ),
                                            ),
                                        )
                                        .request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
                                        .style(WidgetStyle::new().palette("dog_classic".to_string()))
                                ],
                                DistributionWidgetDefinitionType::DISTRIBUTION,
                            )
                                .custom_links(
                                    vec![
                                        WidgetCustomLink::new()
                                            .label("Example".to_string())
                                            .link("https://example.org/".to_string())
                                    ],
                                )
                                .show_legend(false)
                                .title("Metrics HOP".to_string())
                                .title_align(WidgetTextAlign::LEFT)
                                .title_size("16".to_string())
                                .xaxis(
                                    DistributionWidgetXAxis::new()
                                        .include_zero(true)
                                        .max("auto".to_string())
                                        .min("auto".to_string())
                                        .scale("linear".to_string()),
                                )
                                .yaxis(
                                    DistributionWidgetYAxis::new()
                                        .include_zero(true)
                                        .max("auto".to_string())
                                        .min("auto".to_string())
                                        .scale("linear".to_string()),
                                ),
                        ),
                    ),
                ).layout(WidgetLayout::new(2, 4, 0, 0))
            ],
        );
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.create_dashboard(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
  body: {
    title: "Example-Dashboard",
    description: "",
    widgets: [
      {
        definition: {
          title: "APM Stats - Request latency HOP",
          titleSize: "16",
          titleAlign: "left",
          showLegend: false,
          type: "distribution",
          xaxis: {
            max: "auto",
            includeZero: true,
            scale: "linear",
            min: "auto",
          },
          yaxis: {
            max: "auto",
            includeZero: true,
            scale: "linear",
            min: "auto",
          },
          requests: [
            {
              query: {
                primaryTagValue: "*",
                stat: "latency_distribution",
                dataSource: "apm_resource_stats",
                name: "query1",
                service: "azure-bill-import",
                groupBy: ["resource_name"],
                env: "staging",
                primaryTagName: "datacenter",
                operationName: "universal.http.client",
              },
              requestType: "histogram",
              style: {
                palette: "dog_classic",
              },
            },
          ],
        },
        layout: {
          x: 8,
          y: 0,
          width: 4,
          height: 2,
        },
      },
    ],
    layoutType: "ordered",
  },
};

apiInstance
  .createDashboard(params)
  .then((data: v1.Dashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create a distribution widget using a histogram request containing a formulas and functions events query
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
  body: {
    title: "Example-Dashboard",
    description: "Example-Dashboard",
    widgets: [
      {
        definition: {
          title: "Events Platform - Request latency HOP",
          titleSize: "16",
          titleAlign: "left",
          showLegend: false,
          type: "distribution",
          xaxis: {
            max: "auto",
            includeZero: true,
            scale: "linear",
            min: "auto",
          },
          yaxis: {
            max: "auto",
            includeZero: true,
            scale: "linear",
            min: "auto",
          },
          requests: [
            {
              query: {
                search: {
                  query: "",
                },
                dataSource: "events",
                compute: {
                  metric: "@duration",
                  aggregation: "min",
                },
                name: "query1",
                indexes: ["*"],
                groupBy: [],
              },
              requestType: "histogram",
            },
          ],
        },
        layout: {
          x: 0,
          y: 0,
          width: 4,
          height: 2,
        },
      },
    ],
    layoutType: "ordered",
  },
};

apiInstance
  .createDashboard(params)
  .then((data: v1.Dashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Create a distribution widget using a histogram request containing a formulas and functions metrics query
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
  body: {
    title: "Example-Dashboard",
    widgets: [
      {
        definition: {
          title: "Metrics HOP",
          titleSize: "16",
          titleAlign: "left",
          showLegend: false,
          type: "distribution",
          customLinks: [
            {
              label: "Example",
              link: "https://example.org/",
            },
          ],
          xaxis: {
            max: "auto",
            includeZero: true,
            scale: "linear",
            min: "auto",
          },
          yaxis: {
            max: "auto",
            includeZero: true,
            scale: "linear",
            min: "auto",
          },
          requests: [
            {
              query: {
                query: "histogram:trace.Load{*}",
                dataSource: "metrics",
                name: "query1",
              },
              requestType: "histogram",
              style: {
                palette: "dog_classic",
              },
            },
          ],
        },
        layout: {
          x: 0,
          y: 0,
          width: 4,
          height: 2,
        },
      },
    ],
    layoutType: "ordered",
  },
};

apiInstance
  .createDashboard(params)
  .then((data: v1.Dashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

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}

Présentation

Récupérez un dashboard à l’aide de l’ID spécifié. This endpoint requires the dashboards_read permission.

OAuth apps require the dashboards_read authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

dashboard_id [required]

string

The ID of the dashboard.

Réponse

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

Champ

Type

Description

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]

DEPRECATED: A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.

This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.

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.

definition [required]

 <oneOf>

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.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Item Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/${dashboard_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.get_dashboard(
        dashboard_id=DASHBOARD_ID,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Get a dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]
p api_instance.get_dashboard(DASHBOARD_ID)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
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)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// 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)
}

Instructions

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 a dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    try {
      Dashboard result = apiInstance.getDashboard(DASHBOARD_ID);
      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();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
from datadog import initialize, api

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

initialize(**options)

dashboard_id = '<DASHBOARD_ID>'

api.Dashboard.get(dashboard_id)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python "example.py"
// Get a dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.get_dashboard(dashboard_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Get a dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiGetDashboardRequest = {
  dashboardId: DASHBOARD_ID,
};

apiInstance
  .getDashboard(params)
  .then((data: v1.Dashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

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

Présentation

Récupérez tous les dashboards.

Remarque : cette requête ne renvoie pas les dashboards prédéfinis, mais uniquement les dashboards personnalisés créés ou clonés.

This endpoint requires the dashboards_read permission.

OAuth apps require the dashboards_read authorization scope to access this endpoint.

Arguments

Chaînes de requête

Nom

Type

Description

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.

Réponse

OK

Dashboard summary response.

Expand All

Champ

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

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.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all dashboards returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.list_dashboards(
        filter_shared=False,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Get all dashboards returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
opts = {
  filter_shared: false,
}
p api_instance.list_dashboards(opts)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
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()

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// 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)
}

Instructions

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 all dashboards returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.api.DashboardsApi.ListDashboardsOptionalParameters;
import com.datadog.api.client.v1.model.DashboardSummary;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    try {
      DashboardSummary result =
          apiInstance.listDashboards(new ListDashboardsOptionalParameters().filterShared(false));
      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();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
from datadog import initialize, api

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

initialize(**options)

api.Dashboard.get_all()

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python "example.py"
// Get all dashboards returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::api_dashboards::ListDashboardsOptionalParams;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api
        .list_dashboards(ListDashboardsOptionalParams::default().filter_shared(false))
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Get all dashboards returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiListDashboardsRequest = {
  filterShared: false,
};

apiInstance
  .listDashboards(params)
  .then((data: v1.DashboardSummary) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

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}

Présentation

Mettez à jour un dashboard à l’aide de l’ID spécifié. This endpoint requires the dashboards_write permission.

OAuth apps require the dashboards_write authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

dashboard_id [required]

string

The ID of the dashboard.

Requête

Body Data (required)

Corps de requête pour la mise à jour d’un dashboard.

Expand All

Champ

Type

Description

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]

DEPRECATED: A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.

This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.

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.

definition [required]

 <oneOf>

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

Réponse

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

Champ

Type

Description

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]

DEPRECATED: A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.

This property is deprecated; please use the Restriction Policies API instead to manage write authorization for individual dashboards.

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.

definition [required]

 <oneOf>

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.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Item Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/${dashboard_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "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" } ] } } ] } EOF
                          # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/${dashboard_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "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" } ] } } ] } EOF
// 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)
}

Instructions

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"
// Update a dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.ListStreamColumn;
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
import com.datadog.api.client.v1.model.ListStreamQuery;
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
import com.datadog.api.client.v1.model.ListStreamSource;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    Dashboard body =
        new Dashboard()
            .layoutType(DashboardLayoutType.ORDERED)
            .title("Example-Dashboard with list_stream widget")
            .description("Updated description")
            .widgets(
                Collections.singletonList(
                    new Widget()
                        .definition(
                            new WidgetDefinition(
                                new ListStreamWidgetDefinition()
                                    .type(ListStreamWidgetDefinitionType.LIST_STREAM)
                                    .requests(
                                        Collections.singletonList(
                                            new ListStreamWidgetRequest()
                                                .columns(
                                                    Collections.singletonList(
                                                        new ListStreamColumn()
                                                            .width(ListStreamColumnWidth.AUTO)
                                                            .field("timestamp")))
                                                .query(
                                                    new ListStreamQuery()
                                                        .dataSource(
                                                            ListStreamSource.APM_ISSUE_STREAM)
                                                        .queryString(""))
                                                .responseFormat(
                                                    ListStreamResponseFormat.EVENT_LIST)))))));

    try {
      Dashboard result = apiInstance.updateDashboard(DASHBOARD_ID, body);
      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();
    }
  }
}
// Update a dashboard with tags returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.ListStreamColumn;
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
import com.datadog.api.client.v1.model.ListStreamQuery;
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
import com.datadog.api.client.v1.model.ListStreamSource;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import java.util.Arrays;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    Dashboard body =
        new Dashboard()
            .layoutType(DashboardLayoutType.ORDERED)
            .title("Example-Dashboard with list_stream widget")
            .description("Updated description")
            .tags(Arrays.asList("team:foo", "team:bar"))
            .widgets(
                Collections.singletonList(
                    new Widget()
                        .definition(
                            new WidgetDefinition(
                                new ListStreamWidgetDefinition()
                                    .type(ListStreamWidgetDefinitionType.LIST_STREAM)
                                    .requests(
                                        Collections.singletonList(
                                            new ListStreamWidgetRequest()
                                                .columns(
                                                    Collections.singletonList(
                                                        new ListStreamColumn()
                                                            .width(ListStreamColumnWidth.AUTO)
                                                            .field("timestamp")))
                                                .query(
                                                    new ListStreamQuery()
                                                        .dataSource(
                                                            ListStreamSource.APM_ISSUE_STREAM)
                                                        .queryString(""))
                                                .responseFormat(
                                                    ListStreamResponseFormat.EVENT_LIST)))))));

    try {
      Dashboard result = apiInstance.updateDashboard(DASHBOARD_ID, body);
      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();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
"""
Update a dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
from datadog_api_client.v1.model.list_stream_response_format import ListStreamResponseFormat
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
from datadog_api_client.v1.model.list_stream_widget_definition import ListStreamWidgetDefinition
from datadog_api_client.v1.model.list_stream_widget_definition_type import ListStreamWidgetDefinitionType
from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest
from datadog_api_client.v1.model.widget import Widget

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

body = Dashboard(
    layout_type=DashboardLayoutType.ORDERED,
    title="Example-Dashboard with list_stream widget",
    description="Updated description",
    widgets=[
        Widget(
            definition=ListStreamWidgetDefinition(
                type=ListStreamWidgetDefinitionType.LIST_STREAM,
                requests=[
                    ListStreamWidgetRequest(
                        columns=[
                            ListStreamColumn(
                                width=ListStreamColumnWidth.AUTO,
                                field="timestamp",
                            ),
                        ],
                        query=ListStreamQuery(
                            data_source=ListStreamSource.APM_ISSUE_STREAM,
                            query_string="",
                        ),
                        response_format=ListStreamResponseFormat.EVENT_LIST,
                    ),
                ],
            ),
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.update_dashboard(dashboard_id=DASHBOARD_ID, body=body)

    print(response)
"""
Update a dashboard with tags returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
from datadog_api_client.v1.model.list_stream_response_format import ListStreamResponseFormat
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
from datadog_api_client.v1.model.list_stream_widget_definition import ListStreamWidgetDefinition
from datadog_api_client.v1.model.list_stream_widget_definition_type import ListStreamWidgetDefinitionType
from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest
from datadog_api_client.v1.model.widget import Widget

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

body = Dashboard(
    layout_type=DashboardLayoutType.ORDERED,
    title="Example-Dashboard with list_stream widget",
    description="Updated description",
    tags=[
        "team:foo",
        "team:bar",
    ],
    widgets=[
        Widget(
            definition=ListStreamWidgetDefinition(
                type=ListStreamWidgetDefinitionType.LIST_STREAM,
                requests=[
                    ListStreamWidgetRequest(
                        columns=[
                            ListStreamColumn(
                                width=ListStreamColumnWidth.AUTO,
                                field="timestamp",
                            ),
                        ],
                        query=ListStreamQuery(
                            data_source=ListStreamSource.APM_ISSUE_STREAM,
                            query_string="",
                        ),
                        response_format=ListStreamResponseFormat.EVENT_LIST,
                    ),
                ],
            ),
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.update_dashboard(dashboard_id=DASHBOARD_ID, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Update a dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]

body = DatadogAPIClient::V1::Dashboard.new({
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
  title: "Example-Dashboard with list_stream widget",
  description: "Updated description",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::ListStreamWidgetDefinition.new({
        type: DatadogAPIClient::V1::ListStreamWidgetDefinitionType::LIST_STREAM,
        requests: [
          DatadogAPIClient::V1::ListStreamWidgetRequest.new({
            columns: [
              DatadogAPIClient::V1::ListStreamColumn.new({
                width: DatadogAPIClient::V1::ListStreamColumnWidth::AUTO,
                field: "timestamp",
              }),
            ],
            query: DatadogAPIClient::V1::ListStreamQuery.new({
              data_source: DatadogAPIClient::V1::ListStreamSource::APM_ISSUE_STREAM,
              query_string: "",
            }),
            response_format: DatadogAPIClient::V1::ListStreamResponseFormat::EVENT_LIST,
          }),
        ],
      }),
    }),
  ],
})
p api_instance.update_dashboard(DASHBOARD_ID, body)
# Update a dashboard with tags returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]

body = DatadogAPIClient::V1::Dashboard.new({
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
  title: "Example-Dashboard with list_stream widget",
  description: "Updated description",
  tags: [
    "team:foo",
    "team:bar",
  ],
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::ListStreamWidgetDefinition.new({
        type: DatadogAPIClient::V1::ListStreamWidgetDefinitionType::LIST_STREAM,
        requests: [
          DatadogAPIClient::V1::ListStreamWidgetRequest.new({
            columns: [
              DatadogAPIClient::V1::ListStreamColumn.new({
                width: DatadogAPIClient::V1::ListStreamColumnWidth::AUTO,
                field: "timestamp",
              }),
            ],
            query: DatadogAPIClient::V1::ListStreamQuery.new({
              data_source: DatadogAPIClient::V1::ListStreamSource::APM_ISSUE_STREAM,
              query_string: "",
            }),
            response_format: DatadogAPIClient::V1::ListStreamResponseFormat::EVENT_LIST,
          }),
        ],
      }),
    }),
  ],
})
p api_instance.update_dashboard(DASHBOARD_ID, body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Update a dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::ListStreamColumn;
use datadog_api_client::datadogV1::model::ListStreamColumnWidth;
use datadog_api_client::datadogV1::model::ListStreamQuery;
use datadog_api_client::datadogV1::model::ListStreamResponseFormat;
use datadog_api_client::datadogV1::model::ListStreamSource;
use datadog_api_client::datadogV1::model::ListStreamWidgetDefinition;
use datadog_api_client::datadogV1::model::ListStreamWidgetDefinitionType;
use datadog_api_client::datadogV1::model::ListStreamWidgetRequest;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let body = Dashboard::new(
        DashboardLayoutType::ORDERED,
        "Example-Dashboard with list_stream widget".to_string(),
        vec![Widget::new(WidgetDefinition::ListStreamWidgetDefinition(
            Box::new(ListStreamWidgetDefinition::new(
                vec![ListStreamWidgetRequest::new(
                    vec![ListStreamColumn::new(
                        "timestamp".to_string(),
                        ListStreamColumnWidth::AUTO,
                    )],
                    ListStreamQuery::new(ListStreamSource::APM_ISSUE_STREAM, "".to_string()),
                    ListStreamResponseFormat::EVENT_LIST,
                )],
                ListStreamWidgetDefinitionType::LIST_STREAM,
            )),
        ))],
    )
    .description(Some("Updated description".to_string()));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.update_dashboard(dashboard_id.clone(), body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
// Update a dashboard with tags returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::ListStreamColumn;
use datadog_api_client::datadogV1::model::ListStreamColumnWidth;
use datadog_api_client::datadogV1::model::ListStreamQuery;
use datadog_api_client::datadogV1::model::ListStreamResponseFormat;
use datadog_api_client::datadogV1::model::ListStreamSource;
use datadog_api_client::datadogV1::model::ListStreamWidgetDefinition;
use datadog_api_client::datadogV1::model::ListStreamWidgetDefinitionType;
use datadog_api_client::datadogV1::model::ListStreamWidgetRequest;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let body = Dashboard::new(
        DashboardLayoutType::ORDERED,
        "Example-Dashboard with list_stream widget".to_string(),
        vec![Widget::new(WidgetDefinition::ListStreamWidgetDefinition(
            Box::new(ListStreamWidgetDefinition::new(
                vec![ListStreamWidgetRequest::new(
                    vec![ListStreamColumn::new(
                        "timestamp".to_string(),
                        ListStreamColumnWidth::AUTO,
                    )],
                    ListStreamQuery::new(ListStreamSource::APM_ISSUE_STREAM, "".to_string()),
                    ListStreamResponseFormat::EVENT_LIST,
                )],
                ListStreamWidgetDefinitionType::LIST_STREAM,
            )),
        ))],
    )
    .description(Some("Updated description".to_string()))
    .tags(Some(vec!["team:foo".to_string(), "team:bar".to_string()]));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.update_dashboard(dashboard_id.clone(), body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Update a dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiUpdateDashboardRequest = {
  body: {
    layoutType: "ordered",
    title: "Example-Dashboard with list_stream widget",
    description: "Updated description",
    widgets: [
      {
        definition: {
          type: "list_stream",
          requests: [
            {
              columns: [
                {
                  width: "auto",
                  field: "timestamp",
                },
              ],
              query: {
                dataSource: "apm_issue_stream",
                queryString: "",
              },
              responseFormat: "event_list",
            },
          ],
        },
      },
    ],
  },
  dashboardId: DASHBOARD_ID,
};

apiInstance
  .updateDashboard(params)
  .then((data: v1.Dashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Update a dashboard with tags returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiUpdateDashboardRequest = {
  body: {
    layoutType: "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: {
                dataSource: "apm_issue_stream",
                queryString: "",
              },
              responseFormat: "event_list",
            },
          ],
        },
      },
    ],
  },
  dashboardId: DASHBOARD_ID,
};

apiInstance
  .updateDashboard(params)
  .then((data: v1.Dashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

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}

Présentation

Supprimez un dashboard à l’aide de l’ID spécifié. This endpoint requires the dashboards_write permission.

OAuth apps require the dashboards_write authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

dashboard_id [required]

string

The ID of the dashboard.

Réponse

OK

Response from the delete dashboard call.

Expand All

Champ

Type

Description

deleted_dashboard_id

string

ID of the deleted dashboard.

{
  "deleted_dashboard_id": "string"
}

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Dashboards Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  # Path parameters
export dashboard_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/${dashboard_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete a dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.delete_dashboard(
        dashboard_id=DASHBOARD_ID,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Delete a dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]
p api_instance.delete_dashboard(DASHBOARD_ID)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
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)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// 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)
}

Instructions

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 a dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardDeleteResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    try {
      DashboardDeleteResponse result = apiInstance.deleteDashboard(DASHBOARD_ID);
      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();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
from datadog import initialize, api

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

initialize(**options)

dashboard_id = '<DASHBOARD_ID>'

api.Dashboard.delete(dashboard_id)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python "example.py"
// Delete a dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.delete_dashboard(dashboard_id.clone()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Delete a dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiDeleteDashboardRequest = {
  dashboardId: DASHBOARD_ID,
};

apiInstance
  .deleteDashboard(params)
  .then((data: v1.DashboardDeleteResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

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

Présentation

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.

Requête

Body Data (required)

Delete dashboards request body.

Expand All

Champ

Type

Description

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

Réponse

No Content

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Dashboards Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          ## json-request-body
# 

# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "id": "123-abc-456", "type": "dashboard" }, { "id": "789-def-101", "type": "dashboard" } ] } EOF
// 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)
	}
}

Instructions

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 dashboards returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardBulkActionData;
import com.datadog.api.client.v1.model.DashboardBulkDeleteRequest;
import com.datadog.api.client.v1.model.DashboardResourceType;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    DashboardBulkDeleteRequest body =
        new DashboardBulkDeleteRequest()
            .data(
                Collections.singletonList(
                    new DashboardBulkActionData()
                        .id(DASHBOARD_ID)
                        .type(DashboardResourceType.DASHBOARD)));

    try {
      apiInstance.deleteDashboards(body);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#deleteDashboards");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
"""
Delete dashboards returns "No Content" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard_bulk_action_data import DashboardBulkActionData
from datadog_api_client.v1.model.dashboard_bulk_action_data_list import DashboardBulkActionDataList
from datadog_api_client.v1.model.dashboard_bulk_delete_request import DashboardBulkDeleteRequest
from datadog_api_client.v1.model.dashboard_resource_type import DashboardResourceType

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

body = DashboardBulkDeleteRequest(
    data=DashboardBulkActionDataList(
        [
            DashboardBulkActionData(
                id=DASHBOARD_ID,
                type=DashboardResourceType.DASHBOARD,
            ),
        ]
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    api_instance.delete_dashboards(body=body)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Delete dashboards returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]

body = DatadogAPIClient::V1::DashboardBulkDeleteRequest.new({
  data: [
    DatadogAPIClient::V1::DashboardBulkActionData.new({
      id: DASHBOARD_ID,
      type: DatadogAPIClient::V1::DashboardResourceType::DASHBOARD,
    }),
  ],
})
api_instance.delete_dashboards(body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Delete dashboards returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::DashboardBulkActionData;
use datadog_api_client::datadogV1::model::DashboardBulkDeleteRequest;
use datadog_api_client::datadogV1::model::DashboardResourceType;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let body = DashboardBulkDeleteRequest::new(vec![DashboardBulkActionData::new(
        dashboard_id.clone(),
        DashboardResourceType::DASHBOARD,
    )]);
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.delete_dashboards(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Delete dashboards returns "No Content" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiDeleteDashboardsRequest = {
  body: {
    data: [
      {
        id: DASHBOARD_ID,
        type: "dashboard",
      },
    ],
  },
};

apiInstance
  .deleteDashboards(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

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

Présentation

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.

Requête

Body Data (required)

Restore dashboards request body.

Expand All

Champ

Type

Description

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

Réponse

No Content

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Dashboards Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          ## json-request-body
# 

# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "id": "123-abc-456", "type": "dashboard" }, { "id": "789-def-101", "type": "dashboard" } ] } EOF
// 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)
	}
}

Instructions

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"
// Restore deleted dashboards returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardBulkActionData;
import com.datadog.api.client.v1.model.DashboardResourceType;
import com.datadog.api.client.v1.model.DashboardRestoreRequest;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    DashboardRestoreRequest body =
        new DashboardRestoreRequest()
            .data(
                Collections.singletonList(
                    new DashboardBulkActionData()
                        .id(DASHBOARD_ID)
                        .type(DashboardResourceType.DASHBOARD)));

    try {
      apiInstance.restoreDashboards(body);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#restoreDashboards");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
"""
Restore deleted dashboards returns "No Content" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard_bulk_action_data import DashboardBulkActionData
from datadog_api_client.v1.model.dashboard_bulk_action_data_list import DashboardBulkActionDataList
from datadog_api_client.v1.model.dashboard_resource_type import DashboardResourceType
from datadog_api_client.v1.model.dashboard_restore_request import DashboardRestoreRequest

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

body = DashboardRestoreRequest(
    data=DashboardBulkActionDataList(
        [
            DashboardBulkActionData(
                id=DASHBOARD_ID,
                type=DashboardResourceType.DASHBOARD,
            ),
        ]
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    api_instance.restore_dashboards(body=body)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Restore deleted dashboards returns "No Content" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]

body = DatadogAPIClient::V1::DashboardRestoreRequest.new({
  data: [
    DatadogAPIClient::V1::DashboardBulkActionData.new({
      id: DASHBOARD_ID,
      type: DatadogAPIClient::V1::DashboardResourceType::DASHBOARD,
    }),
  ],
})
api_instance.restore_dashboards(body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Restore deleted dashboards returns "No Content" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::DashboardBulkActionData;
use datadog_api_client::datadogV1::model::DashboardResourceType;
use datadog_api_client::datadogV1::model::DashboardRestoreRequest;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let body = DashboardRestoreRequest::new(vec![DashboardBulkActionData::new(
        dashboard_id.clone(),
        DashboardResourceType::DASHBOARD,
    )]);
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.restore_dashboards(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Restore deleted dashboards returns "No Content" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiRestoreDashboardsRequest = {
  body: {
    data: [
      {
        id: DASHBOARD_ID,
        type: "dashboard",
      },
    ],
  },
};

apiInstance
  .restoreDashboards(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/dashboard/publichttps://api.datadoghq.eu/api/v1/dashboard/publichttps://api.ddog-gov.com/api/v1/dashboard/publichttps://api.datadoghq.com/api/v1/dashboard/publichttps://api.us3.datadoghq.com/api/v1/dashboard/publichttps://api.us5.datadoghq.com/api/v1/dashboard/public

Présentation

Partagez un dashboard privé spécifique. Les utilisateurs qui disposent de l’URL générée peuvent accéder au dashboard. This endpoint requires the dashboards_public_share permission.

OAuth apps require the dashboards_public_share authorization scope to access this endpoint.

Requête

Body Data (required)

Corps de requête pour la création d’un dashboard partagé.

Expand All

Champ

Type

Description

author

object

User who shared the dashboard.

handle

string

Identifier of the user who shared the dashboard.

name

string

Name of the user who shared the dashboard.

created_at

date-time

Date the dashboard was shared.

dashboard_id [required]

string

ID of the dashboard to share.

dashboard_type [required]

enum

The type of the associated private dashboard. Allowed enum values: custom_timeboard,custom_screenboard

global_time

object

Object containing the live span selection for the dashboard.

live_span

enum

Dashboard global time live_span selection Allowed enum values: 15m,1h,4h,1d,2d,1w,1mo,3mo

global_time_selectable_enabled

boolean

Whether to allow viewers to select a different global time setting for the shared dashboard.

public_url

string

URL of the shared dashboard.

selectable_template_vars

[object]

List of objects representing template variables on the shared dashboard which can have selectable values.

default_value

string

The default value of the template variable.

name

string

Name of the template variable.

prefix

string

The tag/attribute key associated with the template variable.

visible_tags

[string]

List of visible tag values on the shared dashboard.

share_list

[string]

List of email addresses that can receive an invitation to access to the shared dashboard.

share_type

enum

Type of sharing access (either open to anyone who has the public URL or invite-only). Allowed enum values: open,invite

token

string

A unique token assigned to the shared dashboard.

{
  "dashboard_id": "123-abc-456",
  "dashboard_type": "custom_timeboard",
  "share_type": "open",
  "global_time": {
    "live_span": "1h"
  }
}

Réponse

OK

The metadata object associated with how a dashboard has been/will be shared.

Expand All

Champ

Type

Description

author

object

User who shared the dashboard.

handle

string

Identifier of the user who shared the dashboard.

name

string

Name of the user who shared the dashboard.

created_at

date-time

Date the dashboard was shared.

dashboard_id [required]

string

ID of the dashboard to share.

dashboard_type [required]

enum

The type of the associated private dashboard. Allowed enum values: custom_timeboard,custom_screenboard

global_time

object

Object containing the live span selection for the dashboard.

live_span

enum

Dashboard global time live_span selection Allowed enum values: 15m,1h,4h,1d,2d,1w,1mo,3mo

global_time_selectable_enabled

boolean

Whether to allow viewers to select a different global time setting for the shared dashboard.

public_url

string

URL of the shared dashboard.

selectable_template_vars

[object]

List of objects representing template variables on the shared dashboard which can have selectable values.

default_value

string

The default value of the template variable.

name

string

Name of the template variable.

prefix

string

The tag/attribute key associated with the template variable.

visible_tags

[string]

List of visible tag values on the shared dashboard.

share_list

[string]

List of email addresses that can receive an invitation to access to the shared dashboard.

share_type

enum

Type of sharing access (either open to anyone who has the public URL or invite-only). Allowed enum values: open,invite

token

string

A unique token assigned to the shared dashboard.

{
  "author": {
    "handle": "test@datadoghq.com",
    "name": "string"
  },
  "created_at": "2019-09-19T10:00:00.000Z",
  "dashboard_id": "123-abc-456",
  "dashboard_type": "custom_timeboard",
  "global_time": {
    "live_span": "1h"
  },
  "global_time_selectable_enabled": false,
  "public_url": "string",
  "selectable_template_vars": [
    {
      "default_value": "*",
      "name": "exampleVar",
      "prefix": "test",
      "visible_tags": [
        "selectableValue1",
        "selectableValue2"
      ]
    }
  ],
  "share_list": [
    "test@datadoghq.com",
    "test2@email.com"
  ],
  "share_type": "string",
  "token": "string"
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Dashboard Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          ## json-request-body
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "dashboard_id": "123-abc-456", "dashboard_type": "custom_timeboard", "share_type": "open" } EOF
// Create a shared 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.SharedDashboard{
		DashboardId:   DashboardID,
		DashboardType: datadogV1.DASHBOARDTYPE_CUSTOM_TIMEBOARD,
		ShareType:     *datadogV1.NewNullableDashboardShareType(datadogV1.DASHBOARDSHARETYPE_OPEN.Ptr()),
		GlobalTime: &datadogV1.DashboardGlobalTime{
			LiveSpan: datadogV1.DASHBOARDGLOBALTIMELIVESPAN_PAST_ONE_HOUR.Ptr(),
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewDashboardsApi(apiClient)
	resp, r, err := api.CreatePublicDashboard(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreatePublicDashboard`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreatePublicDashboard`:\n%s\n", responseContent)
}

Instructions

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"
// Create a shared dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardGlobalTime;
import com.datadog.api.client.v1.model.DashboardGlobalTimeLiveSpan;
import com.datadog.api.client.v1.model.DashboardShareType;
import com.datadog.api.client.v1.model.DashboardType;
import com.datadog.api.client.v1.model.SharedDashboard;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "dashboard" in the system
    String DASHBOARD_ID = System.getenv("DASHBOARD_ID");

    SharedDashboard body =
        new SharedDashboard()
            .dashboardId(DASHBOARD_ID)
            .dashboardType(DashboardType.CUSTOM_TIMEBOARD)
            .shareType(DashboardShareType.OPEN)
            .globalTime(
                new DashboardGlobalTime().liveSpan(DashboardGlobalTimeLiveSpan.PAST_ONE_HOUR));

    try {
      SharedDashboard result = apiInstance.createPublicDashboard(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#createPublicDashboard");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
"""
Create a shared dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard_global_time import DashboardGlobalTime
from datadog_api_client.v1.model.dashboard_global_time_live_span import DashboardGlobalTimeLiveSpan
from datadog_api_client.v1.model.dashboard_share_type import DashboardShareType
from datadog_api_client.v1.model.dashboard_type import DashboardType
from datadog_api_client.v1.model.shared_dashboard import SharedDashboard

# there is a valid "dashboard" in the system
DASHBOARD_ID = environ["DASHBOARD_ID"]

body = SharedDashboard(
    dashboard_id=DASHBOARD_ID,
    dashboard_type=DashboardType.CUSTOM_TIMEBOARD,
    share_type=DashboardShareType.OPEN,
    global_time=DashboardGlobalTime(
        live_span=DashboardGlobalTimeLiveSpan.PAST_ONE_HOUR,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.create_public_dashboard(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Create a shared dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "dashboard" in the system
DASHBOARD_ID = ENV["DASHBOARD_ID"]

body = DatadogAPIClient::V1::SharedDashboard.new({
  dashboard_id: DASHBOARD_ID,
  dashboard_type: DatadogAPIClient::V1::DashboardType::CUSTOM_TIMEBOARD,
  share_type: DatadogAPIClient::V1::DashboardShareType::OPEN,
  global_time: DatadogAPIClient::V1::DashboardGlobalTime.new({
    live_span: DatadogAPIClient::V1::DashboardGlobalTimeLiveSpan::PAST_ONE_HOUR,
  }),
})
p api_instance.create_public_dashboard(body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Create a shared dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::DashboardGlobalTime;
use datadog_api_client::datadogV1::model::DashboardGlobalTimeLiveSpan;
use datadog_api_client::datadogV1::model::DashboardShareType;
use datadog_api_client::datadogV1::model::DashboardType;
use datadog_api_client::datadogV1::model::SharedDashboard;

#[tokio::main]
async fn main() {
    // there is a valid "dashboard" in the system
    let dashboard_id = std::env::var("DASHBOARD_ID").unwrap();
    let body = SharedDashboard::new(dashboard_id.clone(), DashboardType::CUSTOM_TIMEBOARD)
        .global_time(
            DashboardGlobalTime::new().live_span(DashboardGlobalTimeLiveSpan::PAST_ONE_HOUR),
        )
        .share_type(Some(DashboardShareType::OPEN));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.create_public_dashboard(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Create a shared dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "dashboard" in the system
const DASHBOARD_ID = process.env.DASHBOARD_ID as string;

const params: v1.DashboardsApiCreatePublicDashboardRequest = {
  body: {
    dashboardId: DASHBOARD_ID,
    dashboardType: "custom_timeboard",
    shareType: "open",
    globalTime: {
      liveSpan: "1h",
    },
  },
};

apiInstance
  .createPublicDashboard(params)
  .then((data: v1.SharedDashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}https://api.datadoghq.eu/api/v1/dashboard/public/{token}https://api.ddog-gov.com/api/v1/dashboard/public/{token}https://api.datadoghq.com/api/v1/dashboard/public/{token}https://api.us3.datadoghq.com/api/v1/dashboard/public/{token}https://api.us5.datadoghq.com/api/v1/dashboard/public/{token}

Présentation

Récupérez les métadonnées de partage d’un dashboard partagé existant associées au token spécifié. This endpoint requires the dashboards_read permission.

OAuth apps require the dashboards_read authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

token [required]

string

The token of the shared dashboard. Generated when a dashboard is shared.

Réponse

OK

The metadata object associated with how a dashboard has been/will be shared.

Expand All

Champ

Type

Description

author

object

User who shared the dashboard.

handle

string

Identifier of the user who shared the dashboard.

name

string

Name of the user who shared the dashboard.

created_at

date-time

Date the dashboard was shared.

dashboard_id [required]

string

ID of the dashboard to share.

dashboard_type [required]

enum

The type of the associated private dashboard. Allowed enum values: custom_timeboard,custom_screenboard

global_time

object

Object containing the live span selection for the dashboard.

live_span

enum

Dashboard global time live_span selection Allowed enum values: 15m,1h,4h,1d,2d,1w,1mo,3mo

global_time_selectable_enabled

boolean

Whether to allow viewers to select a different global time setting for the shared dashboard.

public_url

string

URL of the shared dashboard.

selectable_template_vars

[object]

List of objects representing template variables on the shared dashboard which can have selectable values.

default_value

string

The default value of the template variable.

name

string

Name of the template variable.

prefix

string

The tag/attribute key associated with the template variable.

visible_tags

[string]

List of visible tag values on the shared dashboard.

share_list

[string]

List of email addresses that can receive an invitation to access to the shared dashboard.

share_type

enum

Type of sharing access (either open to anyone who has the public URL or invite-only). Allowed enum values: open,invite

token

string

A unique token assigned to the shared dashboard.

{
  "author": {
    "handle": "test@datadoghq.com",
    "name": "string"
  },
  "created_at": "2019-09-19T10:00:00.000Z",
  "dashboard_id": "123-abc-456",
  "dashboard_type": "custom_timeboard",
  "global_time": {
    "live_span": "1h"
  },
  "global_time_selectable_enabled": false,
  "public_url": "string",
  "selectable_template_vars": [
    {
      "default_value": "*",
      "name": "exampleVar",
      "prefix": "test",
      "visible_tags": [
        "selectableValue1",
        "selectableValue2"
      ]
    }
  ],
  "share_list": [
    "test@datadoghq.com",
    "test2@email.com"
  ],
  "share_type": "string",
  "token": "string"
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Shared Dashboard Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  # Path parameters
export token="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public/${token}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a shared dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = environ["SHARED_DASHBOARD_TOKEN"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.get_public_dashboard(
        token=SHARED_DASHBOARD_TOKEN,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Get a shared dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = ENV["SHARED_DASHBOARD_TOKEN"]
p api_instance.get_public_dashboard(SHARED_DASHBOARD_TOKEN)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Get a shared 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 "shared_dashboard" in the system
	SharedDashboardToken := os.Getenv("SHARED_DASHBOARD_TOKEN")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewDashboardsApi(apiClient)
	resp, r, err := api.GetPublicDashboard(ctx, SharedDashboardToken)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.GetPublicDashboard`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.GetPublicDashboard`:\n%s\n", responseContent)
}

Instructions

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 a shared dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.SharedDashboard;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "shared_dashboard" in the system
    String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN");

    try {
      SharedDashboard result = apiInstance.getPublicDashboard(SHARED_DASHBOARD_TOKEN);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#getPublicDashboard");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
// Get a shared dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;

#[tokio::main]
async fn main() {
    // there is a valid "shared_dashboard" in the system
    let shared_dashboard_token = std::env::var("SHARED_DASHBOARD_TOKEN").unwrap();
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api
        .get_public_dashboard(shared_dashboard_token.clone())
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Get a shared dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "shared_dashboard" in the system
const SHARED_DASHBOARD_TOKEN = process.env.SHARED_DASHBOARD_TOKEN as string;

const params: v1.DashboardsApiGetPublicDashboardRequest = {
  token: SHARED_DASHBOARD_TOKEN,
};

apiInstance
  .getPublicDashboard(params)
  .then((data: v1.SharedDashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

PUT https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}https://api.datadoghq.eu/api/v1/dashboard/public/{token}https://api.ddog-gov.com/api/v1/dashboard/public/{token}https://api.datadoghq.com/api/v1/dashboard/public/{token}https://api.us3.datadoghq.com/api/v1/dashboard/public/{token}https://api.us5.datadoghq.com/api/v1/dashboard/public/{token}

Présentation

Mettez à jour un dashboard partagé associé au token spécifié. This endpoint requires the dashboards_public_share permission.

OAuth apps require the dashboards_public_share authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

token [required]

string

The token of the shared dashboard.

Requête

Body Data (required)

Corps de requête pour la mise à jour d’un dashboard.

Expand All

Champ

Type

Description

global_time [required]

object

Timeframe setting for the shared dashboard.

live_span

enum

Dashboard global time live_span selection Allowed enum values: 15m,1h,4h,1d,2d,1w,1mo,3mo

global_time_selectable_enabled

boolean

Whether to allow viewers to select a different global time setting for the shared dashboard.

selectable_template_vars

[object]

List of objects representing template variables on the shared dashboard which can have selectable values.

default_value

string

The default value of the template variable.

name

string

Name of the template variable.

prefix

string

The tag/attribute key associated with the template variable.

visible_tags

[string]

List of visible tag values on the shared dashboard.

share_list

[string]

List of email addresses that can be given access to the shared dashboard.

share_type

enum

Type of sharing access (either open to anyone who has the public URL or invite-only). Allowed enum values: open,invite

{
  "global_time": {
    "live_span": "15m"
  },
  "share_list": [],
  "share_type": "open"
}

Réponse

OK

The metadata object associated with how a dashboard has been/will be shared.

Expand All

Champ

Type

Description

author

object

User who shared the dashboard.

handle

string

Identifier of the user who shared the dashboard.

name

string

Name of the user who shared the dashboard.

created_at

date-time

Date the dashboard was shared.

dashboard_id [required]

string

ID of the dashboard to share.

dashboard_type [required]

enum

The type of the associated private dashboard. Allowed enum values: custom_timeboard,custom_screenboard

global_time

object

Object containing the live span selection for the dashboard.

live_span

enum

Dashboard global time live_span selection Allowed enum values: 15m,1h,4h,1d,2d,1w,1mo,3mo

global_time_selectable_enabled

boolean

Whether to allow viewers to select a different global time setting for the shared dashboard.

public_url

string

URL of the shared dashboard.

selectable_template_vars

[object]

List of objects representing template variables on the shared dashboard which can have selectable values.

default_value

string

The default value of the template variable.

name

string

Name of the template variable.

prefix

string

The tag/attribute key associated with the template variable.

visible_tags

[string]

List of visible tag values on the shared dashboard.

share_list

[string]

List of email addresses that can receive an invitation to access to the shared dashboard.

share_type

enum

Type of sharing access (either open to anyone who has the public URL or invite-only). Allowed enum values: open,invite

token

string

A unique token assigned to the shared dashboard.

{
  "author": {
    "handle": "test@datadoghq.com",
    "name": "string"
  },
  "created_at": "2019-09-19T10:00:00.000Z",
  "dashboard_id": "123-abc-456",
  "dashboard_type": "custom_timeboard",
  "global_time": {
    "live_span": "1h"
  },
  "global_time_selectable_enabled": false,
  "public_url": "string",
  "selectable_template_vars": [
    {
      "default_value": "*",
      "name": "exampleVar",
      "prefix": "test",
      "visible_tags": [
        "selectableValue1",
        "selectableValue2"
      ]
    }
  ],
  "share_list": [
    "test@datadoghq.com",
    "test2@email.com"
  ],
  "share_type": "string",
  "token": "string"
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Authentication Error

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Item Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          ## json-request-body
# 

# Path parameters
export token="CHANGE_ME"
# Curl command
curl -X PUT "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public/${token}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "global_time": { "live_span": "1h" }, "selectable_template_vars": [ { "default_value": "*", "name": "exampleVar", "prefix": "test", "visible_tags": [ "selectableValue1", "selectableValue2" ] } ], "share_list": [ "test@datadoghq.com", "test2@datadoghq.com" ], "share_type": "invite" } EOF
// Update a shared 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 "shared_dashboard" in the system
	SharedDashboardToken := os.Getenv("SHARED_DASHBOARD_TOKEN")

	body := datadogV1.SharedDashboardUpdateRequest{
		GlobalTime: *datadogV1.NewNullableSharedDashboardUpdateRequestGlobalTime(&datadogV1.SharedDashboardUpdateRequestGlobalTime{
			LiveSpan: datadogV1.DASHBOARDGLOBALTIMELIVESPAN_PAST_FIFTEEN_MINUTES.Ptr(),
		}),
		ShareList: *datadog.NewNullableList(&[]string{}),
		ShareType: *datadogV1.NewNullableDashboardShareType(datadogV1.DASHBOARDSHARETYPE_OPEN.Ptr()),
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewDashboardsApi(apiClient)
	resp, r, err := api.UpdatePublicDashboard(ctx, SharedDashboardToken, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.UpdatePublicDashboard`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.UpdatePublicDashboard`:\n%s\n", responseContent)
}

Instructions

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"
// Update a shared dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardGlobalTimeLiveSpan;
import com.datadog.api.client.v1.model.DashboardShareType;
import com.datadog.api.client.v1.model.SharedDashboard;
import com.datadog.api.client.v1.model.SharedDashboardUpdateRequest;
import com.datadog.api.client.v1.model.SharedDashboardUpdateRequestGlobalTime;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "shared_dashboard" in the system
    String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN");

    SharedDashboardUpdateRequest body =
        new SharedDashboardUpdateRequest()
            .globalTime(
                new SharedDashboardUpdateRequestGlobalTime()
                    .liveSpan(DashboardGlobalTimeLiveSpan.PAST_FIFTEEN_MINUTES))
            .shareType(DashboardShareType.OPEN);

    try {
      SharedDashboard result = apiInstance.updatePublicDashboard(SHARED_DASHBOARD_TOKEN, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#updatePublicDashboard");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
"""
Update a shared dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard_global_time_live_span import DashboardGlobalTimeLiveSpan
from datadog_api_client.v1.model.dashboard_share_type import DashboardShareType
from datadog_api_client.v1.model.shared_dashboard_update_request import SharedDashboardUpdateRequest
from datadog_api_client.v1.model.shared_dashboard_update_request_global_time import (
    SharedDashboardUpdateRequestGlobalTime,
)

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = environ["SHARED_DASHBOARD_TOKEN"]

body = SharedDashboardUpdateRequest(
    global_time=SharedDashboardUpdateRequestGlobalTime(
        live_span=DashboardGlobalTimeLiveSpan.PAST_FIFTEEN_MINUTES,
    ),
    share_list=[],
    share_type=DashboardShareType.OPEN,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.update_public_dashboard(token=SHARED_DASHBOARD_TOKEN, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Update a shared dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = ENV["SHARED_DASHBOARD_TOKEN"]

body = DatadogAPIClient::V1::SharedDashboardUpdateRequest.new({
  global_time: DatadogAPIClient::V1::SharedDashboardUpdateRequestGlobalTime.new({
    live_span: DatadogAPIClient::V1::DashboardGlobalTimeLiveSpan::PAST_FIFTEEN_MINUTES,
  }),
  share_list: [],
  share_type: DatadogAPIClient::V1::DashboardShareType::OPEN,
})
p api_instance.update_public_dashboard(SHARED_DASHBOARD_TOKEN, body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Update a shared dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::DashboardGlobalTimeLiveSpan;
use datadog_api_client::datadogV1::model::DashboardShareType;
use datadog_api_client::datadogV1::model::SharedDashboardUpdateRequest;
use datadog_api_client::datadogV1::model::SharedDashboardUpdateRequestGlobalTime;

#[tokio::main]
async fn main() {
    // there is a valid "shared_dashboard" in the system
    let shared_dashboard_token = std::env::var("SHARED_DASHBOARD_TOKEN").unwrap();
    let body = SharedDashboardUpdateRequest::new(Some(
        SharedDashboardUpdateRequestGlobalTime::new()
            .live_span(DashboardGlobalTimeLiveSpan::PAST_FIFTEEN_MINUTES),
    ))
    .share_list(Some(vec![]))
    .share_type(Some(DashboardShareType::OPEN));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api
        .update_public_dashboard(shared_dashboard_token.clone(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Update a shared dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "shared_dashboard" in the system
const SHARED_DASHBOARD_TOKEN = process.env.SHARED_DASHBOARD_TOKEN as string;

const params: v1.DashboardsApiUpdatePublicDashboardRequest = {
  body: {
    globalTime: {
      liveSpan: "15m",
    },
    shareList: [],
    shareType: "open",
  },
  token: SHARED_DASHBOARD_TOKEN,
};

apiInstance
  .updatePublicDashboard(params)
  .then((data: v1.SharedDashboard) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

POST https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.datadoghq.eu/api/v1/dashboard/public/{token}/invitationhttps://api.ddog-gov.com/api/v1/dashboard/public/{token}/invitationhttps://api.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.us3.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.us5.datadoghq.com/api/v1/dashboard/public/{token}/invitation

Présentation

Envoyez à des adresses spécifiques des e-mails contenant des liens d’accès à un dashboard partagé authentifié spécifique. Les adresses e-mail doivent déjà appartenir à la liste de partage du dashboard partagé authentifié. This endpoint requires the dashboards_public_share permission.

OAuth apps require the dashboards_public_share authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

token [required]

string

The token of the shared dashboard.

Requête

Body Data (required)

Corps de requête pour l’invitation à consulter un dashboard partagé.

Expand All

Champ

Type

Description

data [required]

 <oneOf>

An object or list of objects containing the information for an invitation to a shared dashboard.

Option 1

object

Object containing the information for an invitation to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

Option 2

[object]

A list of objects containing the information for an invitation(s) to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

meta

object

Pagination metadata returned by the API.

page

object

Object containing the total count of invitations across all pages

total_count

int64

The total number of invitations on this shared board, across all pages.

{
  "data": {
    "attributes": {
      "email": "exampledashboard@datadoghq.com"
    },
    "type": "public_dashboard_invitation"
  }
}

Réponse

OK

Invitations data and metadata that exists for a shared dashboard returned by the API.

Expand All

Champ

Type

Description

data [required]

 <oneOf>

An object or list of objects containing the information for an invitation to a shared dashboard.

Option 1

object

Object containing the information for an invitation to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

Option 2

[object]

A list of objects containing the information for an invitation(s) to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

meta

object

Pagination metadata returned by the API.

page

object

Object containing the total count of invitations across all pages

total_count

int64

The total number of invitations on this shared board, across all pages.

{
  "data": [
    "undefined"
  ],
  "meta": {
    "page": {
      "total_count": "integer"
    }
  }
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                          ## json-request-body
# 

# Path parameters
export token="CHANGE_ME"
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public/${token}/invitation" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "attributes": { "email": "test@datadoghq.com" }, "type": "public_dashboard_invitation" } ] } EOF
// Send shared dashboard invitation email 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 "shared_dashboard" in the system
	SharedDashboardToken := os.Getenv("SHARED_DASHBOARD_TOKEN")

	body := datadogV1.SharedDashboardInvites{
		Data: datadogV1.SharedDashboardInvitesData{
			SharedDashboardInvitesDataObject: &datadogV1.SharedDashboardInvitesDataObject{
				Attributes: datadogV1.SharedDashboardInvitesDataObjectAttributes{
					Email: datadog.PtrString("exampledashboard@datadoghq.com"),
				},
				Type: datadogV1.DASHBOARDINVITETYPE_PUBLIC_DASHBOARD_INVITATION,
			}},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewDashboardsApi(apiClient)
	resp, r, err := api.SendPublicDashboardInvitation(ctx, SharedDashboardToken, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.SendPublicDashboardInvitation`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.SendPublicDashboardInvitation`:\n%s\n", responseContent)
}

Instructions

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"
// Send shared dashboard invitation email returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardInviteType;
import com.datadog.api.client.v1.model.SharedDashboardInvites;
import com.datadog.api.client.v1.model.SharedDashboardInvitesData;
import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObject;
import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObjectAttributes;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "shared_dashboard" in the system
    String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN");

    SharedDashboardInvites body =
        new SharedDashboardInvites()
            .data(
                new SharedDashboardInvitesData(
                    new SharedDashboardInvitesDataObject()
                        .attributes(
                            new SharedDashboardInvitesDataObjectAttributes()
                                .email("exampledashboard@datadoghq.com"))
                        .type(DashboardInviteType.PUBLIC_DASHBOARD_INVITATION)));

    try {
      SharedDashboardInvites result =
          apiInstance.sendPublicDashboardInvitation(SHARED_DASHBOARD_TOKEN, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#sendPublicDashboardInvitation");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
"""
Send shared dashboard invitation email returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard_invite_type import DashboardInviteType
from datadog_api_client.v1.model.shared_dashboard_invites import SharedDashboardInvites
from datadog_api_client.v1.model.shared_dashboard_invites_data_object import SharedDashboardInvitesDataObject
from datadog_api_client.v1.model.shared_dashboard_invites_data_object_attributes import (
    SharedDashboardInvitesDataObjectAttributes,
)

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = environ["SHARED_DASHBOARD_TOKEN"]

body = SharedDashboardInvites(
    data=SharedDashboardInvitesDataObject(
        attributes=SharedDashboardInvitesDataObjectAttributes(
            email="exampledashboard@datadoghq.com",
        ),
        type=DashboardInviteType.PUBLIC_DASHBOARD_INVITATION,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.send_public_dashboard_invitation(token=SHARED_DASHBOARD_TOKEN, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Send shared dashboard invitation email returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = ENV["SHARED_DASHBOARD_TOKEN"]

body = DatadogAPIClient::V1::SharedDashboardInvites.new({
  data: DatadogAPIClient::V1::SharedDashboardInvitesDataObject.new({
    attributes: DatadogAPIClient::V1::SharedDashboardInvitesDataObjectAttributes.new({
      email: "exampledashboard@datadoghq.com",
    }),
    type: DatadogAPIClient::V1::DashboardInviteType::PUBLIC_DASHBOARD_INVITATION,
  }),
})
p api_instance.send_public_dashboard_invitation(SHARED_DASHBOARD_TOKEN, body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Send shared dashboard invitation email returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::DashboardInviteType;
use datadog_api_client::datadogV1::model::SharedDashboardInvites;
use datadog_api_client::datadogV1::model::SharedDashboardInvitesData;
use datadog_api_client::datadogV1::model::SharedDashboardInvitesDataObject;
use datadog_api_client::datadogV1::model::SharedDashboardInvitesDataObjectAttributes;

#[tokio::main]
async fn main() {
    // there is a valid "shared_dashboard" in the system
    let shared_dashboard_token = std::env::var("SHARED_DASHBOARD_TOKEN").unwrap();
    let body = SharedDashboardInvites::new(
        SharedDashboardInvitesData::SharedDashboardInvitesDataObject(Box::new(
            SharedDashboardInvitesDataObject::new(
                SharedDashboardInvitesDataObjectAttributes::new()
                    .email("exampledashboard@datadoghq.com".to_string()),
                DashboardInviteType::PUBLIC_DASHBOARD_INVITATION,
            ),
        )),
    );
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api
        .send_public_dashboard_invitation(shared_dashboard_token.clone(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Send shared dashboard invitation email returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "shared_dashboard" in the system
const SHARED_DASHBOARD_TOKEN = process.env.SHARED_DASHBOARD_TOKEN as string;

const params: v1.DashboardsApiSendPublicDashboardInvitationRequest = {
  body: {
    data: {
      attributes: {
        email: "exampledashboard@datadoghq.com",
      },
      type: "public_dashboard_invitation",
    },
  },
  token: SHARED_DASHBOARD_TOKEN,
};

apiInstance
  .sendPublicDashboardInvitation(params)
  .then((data: v1.SharedDashboardInvites) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

GET https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.datadoghq.eu/api/v1/dashboard/public/{token}/invitationhttps://api.ddog-gov.com/api/v1/dashboard/public/{token}/invitationhttps://api.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.us3.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.us5.datadoghq.com/api/v1/dashboard/public/{token}/invitation

Présentation

Décrivez les invitations qui existent pour un dashboard partagé donné (avec pagination). This endpoint requires the dashboards_public_share permission.

OAuth apps require the dashboards_public_share authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

token [required]

string

Token of the shared dashboard for which to fetch invitations.

Chaînes de requête

Nom

Type

Description

page_size

integer

The number of records to return in a single request.

page_number

integer

The page to access (base 0).

Réponse

OK

Invitations data and metadata that exists for a shared dashboard returned by the API.

Expand All

Champ

Type

Description

data [required]

 <oneOf>

An object or list of objects containing the information for an invitation to a shared dashboard.

Option 1

object

Object containing the information for an invitation to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

Option 2

[object]

A list of objects containing the information for an invitation(s) to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

meta

object

Pagination metadata returned by the API.

page

object

Object containing the total count of invitations across all pages

total_count

int64

The total number of invitations on this shared board, across all pages.

{
  "data": [
    "undefined"
  ],
  "meta": {
    "page": {
      "total_count": "integer"
    }
  }
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  # Path parameters
export token="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public/${token}/invitation" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get all invitations for a shared dashboard returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = environ["SHARED_DASHBOARD_TOKEN"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.get_public_dashboard_invitations(
        token=SHARED_DASHBOARD_TOKEN,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Get all invitations for a shared dashboard returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

# there is a valid "shared_dashboard" in the system
SHARED_DASHBOARD_TOKEN = ENV["SHARED_DASHBOARD_TOKEN"]
p api_instance.get_public_dashboard_invitations(SHARED_DASHBOARD_TOKEN)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Get all invitations for a shared 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 "shared_dashboard" in the system
	SharedDashboardToken := os.Getenv("SHARED_DASHBOARD_TOKEN")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewDashboardsApi(apiClient)
	resp, r, err := api.GetPublicDashboardInvitations(ctx, SharedDashboardToken, *datadogV1.NewGetPublicDashboardInvitationsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.GetPublicDashboardInvitations`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.GetPublicDashboardInvitations`:\n%s\n", responseContent)
}

Instructions

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 all invitations for a shared dashboard returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.SharedDashboardInvites;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    // there is a valid "shared_dashboard" in the system
    String SHARED_DASHBOARD_TOKEN = System.getenv("SHARED_DASHBOARD_TOKEN");

    try {
      SharedDashboardInvites result =
          apiInstance.getPublicDashboardInvitations(SHARED_DASHBOARD_TOKEN);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#getPublicDashboardInvitations");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
// Get all invitations for a shared dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::api_dashboards::GetPublicDashboardInvitationsOptionalParams;

#[tokio::main]
async fn main() {
    // there is a valid "shared_dashboard" in the system
    let shared_dashboard_token = std::env::var("SHARED_DASHBOARD_TOKEN").unwrap();
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api
        .get_public_dashboard_invitations(
            shared_dashboard_token.clone(),
            GetPublicDashboardInvitationsOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Get all invitations for a shared dashboard returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

// there is a valid "shared_dashboard" in the system
const SHARED_DASHBOARD_TOKEN = process.env.SHARED_DASHBOARD_TOKEN as string;

const params: v1.DashboardsApiGetPublicDashboardInvitationsRequest = {
  token: SHARED_DASHBOARD_TOKEN,
};

apiInstance
  .getPublicDashboardInvitations(params)
  .then((data: v1.SharedDashboardInvites) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}https://api.datadoghq.eu/api/v1/dashboard/public/{token}https://api.ddog-gov.com/api/v1/dashboard/public/{token}https://api.datadoghq.com/api/v1/dashboard/public/{token}https://api.us3.datadoghq.com/api/v1/dashboard/public/{token}https://api.us5.datadoghq.com/api/v1/dashboard/public/{token}

Présentation

Révoquez l’URL publique pour le dashboard associé à un token spécifique. Ce dashboard devient alors privé. This endpoint requires the dashboards_public_share permission.

OAuth apps require the dashboards_public_share authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

token [required]

string

The token of the shared dashboard.

Réponse

OK

Response containing token of deleted shared dashboard.

Expand All

Champ

Type

Description

deleted_public_dashboard_token

string

Token associated with the shared dashboard that was revoked.

{
  "deleted_public_dashboard_token": "string"
}

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Shared Dashboard Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  # Path parameters
export token="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public/${token}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Revoke a shared dashboard URL returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    response = api_instance.delete_public_dashboard(
        token="token",
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Revoke a shared dashboard URL returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
p api_instance.delete_public_dashboard("token")

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Revoke a shared dashboard URL 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.DeletePublicDashboard(ctx, "token")

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.DeletePublicDashboard`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.DeletePublicDashboard`:\n%s\n", responseContent)
}

Instructions

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"
// Revoke a shared dashboard URL returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DeleteSharedDashboardResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    try {
      DeleteSharedDashboardResponse result = apiInstance.deletePublicDashboard("token");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#deletePublicDashboard");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
// Revoke a shared dashboard URL returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api.delete_public_dashboard("token".to_string()).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Revoke a shared dashboard URL returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiDeletePublicDashboardRequest = {
  token: "token",
};

apiInstance
  .deletePublicDashboard(params)
  .then((data: v1.DeleteSharedDashboardResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

DELETE https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.datadoghq.eu/api/v1/dashboard/public/{token}/invitationhttps://api.ddog-gov.com/api/v1/dashboard/public/{token}/invitationhttps://api.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.us3.datadoghq.com/api/v1/dashboard/public/{token}/invitationhttps://api.us5.datadoghq.com/api/v1/dashboard/public/{token}/invitation

Présentation

Révoquez, pour des adresses e-mail précises, les e-mails d’invitation envoyés précédemment et les sessions actives utilisées afin d’accéder à un dashboard partagé donné. This endpoint requires the dashboards_public_share permission.

OAuth apps require the dashboards_public_share authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Nom

Type

Description

token [required]

string

The token of the shared dashboard.

Requête

Body Data (required)

Corps de requête pour la suppression d’une invitation à consulter un dashboard partagé.

Expand All

Champ

Type

Description

data [required]

 <oneOf>

An object or list of objects containing the information for an invitation to a shared dashboard.

Option 1

object

Object containing the information for an invitation to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

Option 2

[object]

A list of objects containing the information for an invitation(s) to a shared dashboard.

attributes [required]

object

Attributes of the shared dashboard invitation

created_at

date-time

When the invitation was sent.

email

string

An email address that an invitation has been (or if used in invitation request, will be) sent to.

has_session

boolean

Indicates whether an active session exists for the invitation (produced when a user clicks the link in the email).

invitation_expiry

date-time

When the invitation expires.

session_expiry

date-time

When the invited user's session expires. null if the invitation has no associated session.

share_token

string

The unique token of the shared dashboard that was (or is to be) shared.

type [required]

enum

Type for shared dashboard invitation request body. Allowed enum values: public_dashboard_invitation

meta

object

Pagination metadata returned by the API.

page

object

Object containing the total count of invitations across all pages

total_count

int64

The total number of invitations on this shared board, across all pages.

{
  "data": [
    "undefined"
  ]
}

Réponse

OK

Forbidden

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Too many requests

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

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

Exemple de code

                  ## json-request-body
# 

# Path parameters
export token="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v1/dashboard/public/${token}/invitation" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "email": "test@datadoghq.com" }, "type": "public_dashboard_invitation" } } EOF
"""
Revoke shared dashboard invitations returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard_invite_type import DashboardInviteType
from datadog_api_client.v1.model.shared_dashboard_invites import SharedDashboardInvites
from datadog_api_client.v1.model.shared_dashboard_invites_data_list import SharedDashboardInvitesDataList
from datadog_api_client.v1.model.shared_dashboard_invites_data_object import SharedDashboardInvitesDataObject
from datadog_api_client.v1.model.shared_dashboard_invites_data_object_attributes import (
    SharedDashboardInvitesDataObjectAttributes,
)

body = SharedDashboardInvites(
    data=SharedDashboardInvitesDataList(
        [
            SharedDashboardInvitesDataObject(
                attributes=SharedDashboardInvitesDataObjectAttributes(
                    email="test@datadoghq.com",
                ),
                type=DashboardInviteType.PUBLIC_DASHBOARD_INVITATION,
            ),
        ]
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = DashboardsApi(api_client)
    api_instance.delete_public_dashboard_invitation(token="token", body=body)

Instructions

First install the library and its dependencies and then save the example to example.py 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>" python3 "example.py"
# Revoke shared dashboard invitations returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::SharedDashboardInvites.new({
  data: [
    DatadogAPIClient::V1::SharedDashboardInvitesDataObject.new({
      attributes: DatadogAPIClient::V1::SharedDashboardInvitesDataObjectAttributes.new({
        email: "test@datadoghq.com",
      }),
      type: DatadogAPIClient::V1::DashboardInviteType::PUBLIC_DASHBOARD_INVITATION,
    }),
  ],
})
api_instance.delete_public_dashboard_invitation("token", body)

Instructions

First install the library and its dependencies and then save the example to example.rb 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>" rb "example.rb"
// Revoke shared dashboard invitations returns "OK" 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() {
	body := datadogV1.SharedDashboardInvites{
		Data: datadogV1.SharedDashboardInvitesData{
			SharedDashboardInvitesDataList: &[]datadogV1.SharedDashboardInvitesDataObject{
				{
					Attributes: datadogV1.SharedDashboardInvitesDataObjectAttributes{
						Email: datadog.PtrString("test@datadoghq.com"),
					},
					Type: datadogV1.DASHBOARDINVITETYPE_PUBLIC_DASHBOARD_INVITATION,
				},
			}},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewDashboardsApi(apiClient)
	r, err := api.DeletePublicDashboardInvitation(ctx, "token", body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.DeletePublicDashboardInvitation`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Instructions

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"
// Revoke shared dashboard invitations returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.DashboardInviteType;
import com.datadog.api.client.v1.model.SharedDashboardInvites;
import com.datadog.api.client.v1.model.SharedDashboardInvitesData;
import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObject;
import com.datadog.api.client.v1.model.SharedDashboardInvitesDataObjectAttributes;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    DashboardsApi apiInstance = new DashboardsApi(defaultClient);

    SharedDashboardInvites body =
        new SharedDashboardInvites()
            .data(
                new SharedDashboardInvitesData(
                    Collections.singletonList(
                        new SharedDashboardInvitesDataObject()
                            .attributes(
                                new SharedDashboardInvitesDataObjectAttributes()
                                    .email("test@datadoghq.com"))
                            .type(DashboardInviteType.PUBLIC_DASHBOARD_INVITATION))));

    try {
      apiInstance.deletePublicDashboardInvitation("token", body);
    } catch (ApiException e) {
      System.err.println("Exception when calling DashboardsApi#deletePublicDashboardInvitation");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java 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>" java "Example.java"
// Revoke shared dashboard invitations returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::DashboardInviteType;
use datadog_api_client::datadogV1::model::SharedDashboardInvites;
use datadog_api_client::datadogV1::model::SharedDashboardInvitesData;
use datadog_api_client::datadogV1::model::SharedDashboardInvitesDataObject;
use datadog_api_client::datadogV1::model::SharedDashboardInvitesDataObjectAttributes;

#[tokio::main]
async fn main() {
    let body =
        SharedDashboardInvites::new(SharedDashboardInvitesData::SharedDashboardInvitesDataList(
            vec![SharedDashboardInvitesDataObject::new(
                SharedDashboardInvitesDataObjectAttributes::new()
                    .email("test@datadoghq.com".to_string()),
                DashboardInviteType::PUBLIC_DASHBOARD_INVITATION,
            )],
        ));
    let configuration = datadog::Configuration::new();
    let api = DashboardsAPI::with_config(configuration);
    let resp = api
        .delete_public_dashboard_invitation("token".to_string(), body)
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs 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>" cargo run
/**
 * Revoke shared dashboard invitations returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiDeletePublicDashboardInvitationRequest = {
  body: {
    data: [
      {
        attributes: {
          email: "test@datadoghq.com",
        },
        type: "public_dashboard_invitation",
      },
    ],
  },
  token: "token",
};

apiInstance
  .deletePublicDashboardInvitation(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts 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>" tsc "example.ts"

PREVIEWING: rtrieu/product-analytics-ui-changes