Update a secure embed for a dashboard
https://api.datadoghq.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.us3.datadoghq.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.us5.datadoghq.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.datadoghq.eu/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.ap1.datadoghq.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.ap2.datadoghq.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.uk1.datadoghq.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.ddog-gov.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}https://api.us2.ddog-gov.com/api/v2/dashboard/{dashboard_id}/shared/secure-embed/{token}Descripción general
Partially update a secure embed configuration. All fields are optional (PATCH semantics).
OAuth apps require the dashboards_embed_share authorization scope to access this endpoint.
Argumentos
Parámetros de ruta
dashboard_id [required]The ID of the dashboard.
token [required]The share token identifying the secure embed.
Solicitud
Body Data (required)
Secure embed update request body.
data [required]Data object for updating a secure embed.
attributes [required]Attributes for updating a secure embed shared dashboard. All fields are optional.
global_timeDefault time range configuration for the secure embed.
live_spanDashboard global time live_span selection.
15m, 1h, 4h, 1d, 2d, 1w, 1mo, 3moglobal_time_selectableUpdated time selectability.
selectable_template_varsUpdated template variables.
default_valuesDefault selected values for the variable.
nameName of the template variable. Usually matches the prefix unless you want a different display name.
prefixTag prefix for the variable (e.g., environment, service).
visible_tagsRestrict which tag values are visible to the viewer.
statusThe status of the secure embed share. Active means the shared dashboard is available. Paused means it is not.
active, pausedtitleUpdated title.
viewing_preferencesDisplay settings for the secure embed shared dashboard.
high_densityWhether widgets are displayed in high density mode.
themeThe theme of the shared dashboard view. system follows the viewer's system default.
system, light, darktype [required]Resource type for secure embed update requests.
secure_embed_update_request{
"data": {
"attributes": {
"global_time": {
"live_span": "1h"
},
"global_time_selectable": true,
"selectable_template_vars": [
{
"default_values": [
"1"
],
"name": "org_id",
"prefix": "org_id",
"visible_tags": [
"1"
]
}
],
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)",
"viewing_preferences": {
"high_density": false,
"theme": "system"
}
},
"type": "secure_embed_update_request"
}
}Respuesta
OK
Response for updating a secure embed shared dashboard.
data [required]Data object for a secure embed update response.
attributes [required]Attributes of an updated secure embed shared dashboard.
created_atCreation timestamp.
credential_suffixLast 4 characters of the credential. Defaults to 0000 if unavailable.
dashboard_idThe source dashboard ID.
global_timeDefault time range configuration for the secure embed.
live_spanDashboard global time live_span selection.
15m, 1h, 4h, 1d, 2d, 1w, 1mo, 3moglobal_time_selectableWhether time range is viewer-selectable.
idInternal share ID.
selectable_template_varsTemplate variables with their configuration.
default_valuesDefault selected values for the variable.
nameName of the template variable. Usually matches the prefix unless you want a different display name.
prefixTag prefix for the variable (e.g., environment, service).
visible_tagsRestrict which tag values are visible to the viewer.
share_typeThe type of share. Always secure_embed.
secure_embedstatusThe status of the secure embed share. Active means the shared dashboard is available. Paused means it is not.
active, pausedtitleDisplay title.
tokenPublic share token.
urlCDN URL for the shared dashboard.
viewing_preferencesDisplay settings for the secure embed shared dashboard.
high_densityWhether widgets are displayed in high density mode.
themeThe theme of the shared dashboard view. system follows the viewer's system default.
system, light, darkid [required]Internal share ID.
type [required]Resource type for secure embed update responses.
secure_embed_update_response{
"data": {
"attributes": {
"created_at": "2026-03-11T18:30:00.000000",
"credential_suffix": "ab3f",
"dashboard_id": "abc-def-ghi",
"global_time": {
"live_span": "1h"
},
"global_time_selectable": true,
"id": "12345",
"selectable_template_vars": [
{
"default_values": [
"1"
],
"name": "org_id",
"prefix": "org_id",
"visible_tags": [
"1"
]
}
],
"share_type": "secure_embed",
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)",
"token": "s3cur3t0k3n-abcdef123456",
"url": "https://p.datadoghq.com/sb/secure-embed/s3cur3t0k3n-abcdef123456",
"viewing_preferences": {
"high_density": false,
"theme": "system"
}
},
"id": "12345",
"type": "secure_embed_update_response"
}
}Forbidden
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Not Found
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Ejemplo de código
# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF# Path parameters
export dashboard_id="abc-def-ghi"
export token="s3cur3t0k3n-abcdef123456"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/dashboard/${dashboard_id}/shared/secure-embed/${token}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"status": "active",
"title": "Q1 Metrics Dashboard (Updated)"
},
"type": "secure_embed_update_request"
}
}
EOF// Update a secure embed for 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/datadogV2"
)
func main() {
body := datadogV2.SecureEmbedUpdateRequest{
Data: datadogV2.SecureEmbedUpdateRequestData{
Attributes: datadogV2.SecureEmbedUpdateRequestAttributes{
GlobalTime: &datadogV2.SecureEmbedGlobalTime{
LiveSpan: datadogV2.SECUREEMBEDGLOBALTIMELIVESPAN_PAST_ONE_HOUR.Ptr(),
},
GlobalTimeSelectable: datadog.PtrBool(true),
SelectableTemplateVars: []datadogV2.SecureEmbedSelectableTemplateVariable{
{
DefaultValues: []string{
"1",
},
Name: datadog.PtrString("org_id"),
Prefix: datadog.PtrString("org_id"),
VisibleTags: []string{
"1",
},
},
},
Status: datadogV2.SECUREEMBEDSTATUS_ACTIVE.Ptr(),
Title: datadog.PtrString("Q1 Metrics Dashboard (Updated)"),
ViewingPreferences: &datadogV2.SecureEmbedViewingPreferences{
HighDensity: datadog.PtrBool(false),
Theme: datadogV2.SECUREEMBEDVIEWINGPREFERENCESTHEME_SYSTEM.Ptr(),
},
},
Type: datadogV2.SECUREEMBEDUPDATEREQUESTTYPE_SECURE_EMBED_UPDATE_REQUEST,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.UpdateDashboardSecureEmbed", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewDashboardSecureEmbedApi(apiClient)
resp, r, err := api.UpdateDashboardSecureEmbed(ctx, "dashboard_id", "token", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DashboardSecureEmbedApi.UpdateDashboardSecureEmbed`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `DashboardSecureEmbedApi.UpdateDashboardSecureEmbed`:\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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Update a secure embed for a dashboard returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DashboardSecureEmbedApi;
import com.datadog.api.client.v2.model.SecureEmbedGlobalTime;
import com.datadog.api.client.v2.model.SecureEmbedGlobalTimeLiveSpan;
import com.datadog.api.client.v2.model.SecureEmbedSelectableTemplateVariable;
import com.datadog.api.client.v2.model.SecureEmbedStatus;
import com.datadog.api.client.v2.model.SecureEmbedUpdateRequest;
import com.datadog.api.client.v2.model.SecureEmbedUpdateRequestAttributes;
import com.datadog.api.client.v2.model.SecureEmbedUpdateRequestData;
import com.datadog.api.client.v2.model.SecureEmbedUpdateRequestType;
import com.datadog.api.client.v2.model.SecureEmbedUpdateResponse;
import com.datadog.api.client.v2.model.SecureEmbedViewingPreferences;
import com.datadog.api.client.v2.model.SecureEmbedViewingPreferencesTheme;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.updateDashboardSecureEmbed", true);
DashboardSecureEmbedApi apiInstance = new DashboardSecureEmbedApi(defaultClient);
SecureEmbedUpdateRequest body =
new SecureEmbedUpdateRequest()
.data(
new SecureEmbedUpdateRequestData()
.attributes(
new SecureEmbedUpdateRequestAttributes()
.globalTime(
new SecureEmbedGlobalTime()
.liveSpan(SecureEmbedGlobalTimeLiveSpan.PAST_ONE_HOUR))
.globalTimeSelectable(true)
.selectableTemplateVars(
Collections.singletonList(
new SecureEmbedSelectableTemplateVariable()
.defaultValues(Collections.singletonList("1"))
.name("org_id")
.prefix("org_id")
.visibleTags(Collections.singletonList("1"))))
.status(SecureEmbedStatus.ACTIVE)
.title("Q1 Metrics Dashboard (Updated)")
.viewingPreferences(
new SecureEmbedViewingPreferences()
.highDensity(false)
.theme(SecureEmbedViewingPreferencesTheme.SYSTEM)))
.type(SecureEmbedUpdateRequestType.SECURE_EMBED_UPDATE_REQUEST));
try {
SecureEmbedUpdateResponse result =
apiInstance.updateDashboardSecureEmbed("abc-def-ghi", "s3cur3t0k3n-abcdef123456", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling DashboardSecureEmbedApi#updateDashboardSecureEmbed");
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Update a secure embed for a dashboard returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.dashboard_secure_embed_api import DashboardSecureEmbedApi
from datadog_api_client.v2.model.secure_embed_global_time import SecureEmbedGlobalTime
from datadog_api_client.v2.model.secure_embed_global_time_live_span import SecureEmbedGlobalTimeLiveSpan
from datadog_api_client.v2.model.secure_embed_selectable_template_variable import SecureEmbedSelectableTemplateVariable
from datadog_api_client.v2.model.secure_embed_status import SecureEmbedStatus
from datadog_api_client.v2.model.secure_embed_update_request import SecureEmbedUpdateRequest
from datadog_api_client.v2.model.secure_embed_update_request_attributes import SecureEmbedUpdateRequestAttributes
from datadog_api_client.v2.model.secure_embed_update_request_data import SecureEmbedUpdateRequestData
from datadog_api_client.v2.model.secure_embed_update_request_type import SecureEmbedUpdateRequestType
from datadog_api_client.v2.model.secure_embed_viewing_preferences import SecureEmbedViewingPreferences
from datadog_api_client.v2.model.secure_embed_viewing_preferences_theme import SecureEmbedViewingPreferencesTheme
body = SecureEmbedUpdateRequest(
data=SecureEmbedUpdateRequestData(
attributes=SecureEmbedUpdateRequestAttributes(
global_time=SecureEmbedGlobalTime(
live_span=SecureEmbedGlobalTimeLiveSpan.PAST_ONE_HOUR,
),
global_time_selectable=True,
selectable_template_vars=[
SecureEmbedSelectableTemplateVariable(
default_values=[
"1",
],
name="org_id",
prefix="org_id",
visible_tags=[
"1",
],
),
],
status=SecureEmbedStatus.ACTIVE,
title="Q1 Metrics Dashboard (Updated)",
viewing_preferences=SecureEmbedViewingPreferences(
high_density=False,
theme=SecureEmbedViewingPreferencesTheme.SYSTEM,
),
),
type=SecureEmbedUpdateRequestType.SECURE_EMBED_UPDATE_REQUEST,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["update_dashboard_secure_embed"] = True
with ApiClient(configuration) as api_client:
api_instance = DashboardSecureEmbedApi(api_client)
response = api_instance.update_dashboard_secure_embed(dashboard_id="dashboard_id", token="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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Update a secure embed for a dashboard returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.update_dashboard_secure_embed".to_sym] = true
end
api_instance = DatadogAPIClient::V2::DashboardSecureEmbedAPI.new
body = DatadogAPIClient::V2::SecureEmbedUpdateRequest.new({
data: DatadogAPIClient::V2::SecureEmbedUpdateRequestData.new({
attributes: DatadogAPIClient::V2::SecureEmbedUpdateRequestAttributes.new({
global_time: DatadogAPIClient::V2::SecureEmbedGlobalTime.new({
live_span: DatadogAPIClient::V2::SecureEmbedGlobalTimeLiveSpan::PAST_ONE_HOUR,
}),
global_time_selectable: true,
selectable_template_vars: [
DatadogAPIClient::V2::SecureEmbedSelectableTemplateVariable.new({
default_values: [
"1",
],
name: "org_id",
prefix: "org_id",
visible_tags: [
"1",
],
}),
],
status: DatadogAPIClient::V2::SecureEmbedStatus::ACTIVE,
title: "Q1 Metrics Dashboard (Updated)",
viewing_preferences: DatadogAPIClient::V2::SecureEmbedViewingPreferences.new({
high_density: false,
theme: DatadogAPIClient::V2::SecureEmbedViewingPreferencesTheme::SYSTEM,
}),
}),
type: DatadogAPIClient::V2::SecureEmbedUpdateRequestType::SECURE_EMBED_UPDATE_REQUEST,
}),
})
p api_instance.update_dashboard_secure_embed("dashboard_id", "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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Update a secure embed for a dashboard returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_dashboard_secure_embed::DashboardSecureEmbedAPI;
use datadog_api_client::datadogV2::model::SecureEmbedGlobalTime;
use datadog_api_client::datadogV2::model::SecureEmbedGlobalTimeLiveSpan;
use datadog_api_client::datadogV2::model::SecureEmbedSelectableTemplateVariable;
use datadog_api_client::datadogV2::model::SecureEmbedStatus;
use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequest;
use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequestAttributes;
use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequestData;
use datadog_api_client::datadogV2::model::SecureEmbedUpdateRequestType;
use datadog_api_client::datadogV2::model::SecureEmbedViewingPreferences;
use datadog_api_client::datadogV2::model::SecureEmbedViewingPreferencesTheme;
#[tokio::main]
async fn main() {
let body = SecureEmbedUpdateRequest::new(SecureEmbedUpdateRequestData::new(
SecureEmbedUpdateRequestAttributes::new()
.global_time(
SecureEmbedGlobalTime::new()
.live_span(SecureEmbedGlobalTimeLiveSpan::PAST_ONE_HOUR),
)
.global_time_selectable(true)
.selectable_template_vars(vec![SecureEmbedSelectableTemplateVariable::new()
.default_values(vec!["1".to_string()])
.name("org_id".to_string())
.prefix("org_id".to_string())
.visible_tags(vec!["1".to_string()])])
.status(SecureEmbedStatus::ACTIVE)
.title("Q1 Metrics Dashboard (Updated)".to_string())
.viewing_preferences(
SecureEmbedViewingPreferences::new()
.high_density(false)
.theme(SecureEmbedViewingPreferencesTheme::SYSTEM),
),
SecureEmbedUpdateRequestType::SECURE_EMBED_UPDATE_REQUEST,
));
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.update_dashboard_secure_embed", true);
let api = DashboardSecureEmbedAPI::with_config(configuration);
let resp = api
.update_dashboard_secure_embed("dashboard_id".to_string(), "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.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Update a secure embed for a dashboard returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.updateDashboardSecureEmbed"] = true;
const apiInstance = new v2.DashboardSecureEmbedApi(configuration);
const params: v2.DashboardSecureEmbedApiUpdateDashboardSecureEmbedRequest = {
body: {
data: {
attributes: {
globalTime: {
liveSpan: "1h",
},
globalTimeSelectable: true,
selectableTemplateVars: [
{
defaultValues: ["1"],
name: "org_id",
prefix: "org_id",
visibleTags: ["1"],
},
],
status: "active",
title: "Q1 Metrics Dashboard (Updated)",
viewingPreferences: {
highDensity: false,
theme: "system",
},
},
type: "secure_embed_update_request",
},
},
dashboardId: "dashboard_id",
token: "token",
};
apiInstance
.updateDashboardSecureEmbed(params)
.then((data: v2.SecureEmbedUpdateResponse) => {
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"