Update a shared dashboard

PUT https://api.ap1.datadoghq.com/api/v1/dashboard/public/{token}https://api.ap2.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.us2.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}

Overview

Update a shared dashboard associated with the specified token. This endpoint requires any of the following permissions:

  • dashboards_public_share
  • dashboards_embed_share
  • dashboards_invite_share

  • OAuth apps require the dashboards_invite_share authorization scope to access this endpoint.

    Arguments

    Path Parameters

    Name

    Type

    Description

    token [required]

    string

    The token of the shared dashboard.

    Request

    Body Data (required)

    Update Dashboard request body.

    Expand All

    Field

    Type

    Description

    embeddable_domains

    [string]

    The SharedDashboard embeddable_domains.

    expiration

    date-time

    The time when an OPEN shared dashboard becomes publicly unavailable.

    global_time

    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.

    invitees

    [object]

    The SharedDashboard invitees.

    access_expiration

    date-time

    Time of the invitee expiration. Null means the invite will not expire.

    created_at

    date-time

    Time that the invitee was created.

    email [required]

    string

    Email of the invitee.

    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.

    type

    string

    The type of variable. This is to differentiate between filter variables (interpolated in query) and group by variables (interpolated into group by).

    visible_tags

    [string]

    List of visible tag values on the shared dashboard.

    share_list

    [string]

    DEPRECATED: 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,embed

    status

    enum

    Active means the dashboard is publicly available. Paused means the dashboard is not publicly available. Allowed enum values: active,paused

    title

    string

    Title of the shared dashboard.

    viewing_preferences

    object

    The viewing preferences for a shared dashboard.

    high_density

    boolean

    Whether the widgets on the shared dashboard should be displayed with high density.

    theme

    enum

    The theme of the shared dashboard view. "system" follows your system's default viewing theme. Allowed enum values: system,light,dark

    {
      "global_time": {
        "live_span": "15m"
      },
      "share_list": [],
      "share_type": "open"
    }
    {
      "global_time": {
        "live_span": "15m"
      },
      "share_list": [],
      "share_type": "open",
      "selectable_template_vars": [
        {
          "default_value": "*",
          "name": "group_by_var",
          "type": "group",
          "visible_tags": [
            "selectableValue1",
            "selectableValue2"
          ]
        }
      ]
    }

    Response

    OK

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

    Expand All

    Field

    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

    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

    embeddable_domains

    [string]

    The SharedDashboard embeddable_domains.

    expiration

    date-time

    The time when an OPEN shared dashboard becomes publicly unavailable.

    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.

    invitees

    [object]

    The SharedDashboard invitees.

    access_expiration

    date-time

    Time of the invitee expiration. Null means the invite will not expire.

    created_at

    date-time

    Time that the invitee was created.

    email [required]

    string

    Email of the invitee.

    last_accessed

    date-time

    The last time the shared dashboard was accessed. Null if never accessed.

    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.

    type

    string

    The type of variable. This is to differentiate between filter variables (interpolated in query) and group by variables (interpolated into group by).

    visible_tags

    [string]

    List of visible tag values on the shared dashboard.

    share_list

    [string]

    DEPRECATED: 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,embed

    status

    enum

    Active means the dashboard is publicly available. Paused means the dashboard is not publicly available. Allowed enum values: active,paused

    title

    string

    Title of the shared dashboard.

    token

    string

    A unique token assigned to the shared dashboard.

    viewing_preferences

    object

    The viewing preferences for a shared dashboard.

    high_density

    boolean

    Whether the widgets on the shared dashboard should be displayed with high density.

    theme

    enum

    The theme of the shared dashboard view. "system" follows your system's default viewing theme. Allowed enum values: system,light,dark

    {
      "author": {
        "handle": "test@datadoghq.com",
        "name": "string"
      },
      "created": "2019-09-19T10:00:00.000Z",
      "dashboard_id": "123-abc-456",
      "dashboard_type": "custom_timeboard",
      "embeddable_domains": [
        "https://domain.atlassian.net/",
        "http://myserver.com/"
      ],
      "expiration": "2019-09-19T10:00:00.000Z",
      "global_time": {
        "live_span": "1h"
      },
      "global_time_selectable_enabled": false,
      "invitees": [
        {
          "access_expiration": "2019-09-19T10:00:00.000Z",
          "created_at": "2019-09-19T10:00:00.000Z",
          "email": "test@datadoghq.com"
        }
      ],
      "last_accessed": "2019-09-19T10:00:00.000Z",
      "public_url": "string",
      "selectable_template_vars": [
        {
          "default_value": "*",
          "name": "exampleVar",
          "prefix": "test",
          "type": "string",
          "visible_tags": [
            "selectableValue1",
            "selectableValue2"
          ]
        }
      ],
      "share_list": [
        "test@datadoghq.com",
        "test2@email.com"
      ],
      "share_type": "string",
      "status": "active",
      "title": "string",
      "token": "string",
      "viewing_preferences": {
        "high_density": false,
        "theme": "string"
      }
    }

    Bad Request

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Authentication Error

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Item Not Found

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Too many requests

    Error response object.

    Expand All

    Field

    Type

    Description

    errors [required]

    [string]

    Array of errors returned by the API.

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

    Code Example

                              ## default
    # 
    
    # Path parameters
    export token="CHANGE_ME"
    # Curl command
    curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.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
    ## json-request-body #
    # Path parameters
    export token="CHANGE_ME"
    # Curl command
    curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.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
                              ## default
    # 
    
    # Path parameters
    export token="CHANGE_ME"
    # Curl command
    curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.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
    ## json-request-body #
    # Path parameters
    export token="CHANGE_ME"
    # Curl command
    curl -X PUT "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.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)
    }
    
    // Update a shared dashboard with selectable_template_vars 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()),
    		SelectableTemplateVars: []datadogV1.SelectableTemplateVariableItems{
    			{
    				DefaultValue: datadog.PtrString("*"),
    				Name:         datadog.PtrString("group_by_var"),
    				Type:         *datadog.NewNullableString(datadog.PtrString("group")),
    				VisibleTags: *datadog.NewNullableList(&[]string{
    					"selectableValue1",
    					"selectableValue2",
    				}),
    			},
    		},
    	}
    	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.comap2.datadoghq.comddog-gov.comus2.ddog-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();
        }
      }
    }
    
    // Update a shared dashboard with selectable_template_vars 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.SelectableTemplateVariableItems;
    import com.datadog.api.client.v1.model.SharedDashboard;
    import com.datadog.api.client.v1.model.SharedDashboardUpdateRequest;
    import com.datadog.api.client.v1.model.SharedDashboardUpdateRequestGlobalTime;
    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 "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)
                .selectableTemplateVars(
                    Collections.singletonList(
                        new SelectableTemplateVariableItems()
                            .defaultValue("*")
                            .name("group_by_var")
                            .type("group")
                            .visibleTags(Arrays.asList("selectableValue1", "selectableValue2"))));
    
        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.comap2.datadoghq.comddog-gov.comus2.ddog-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)
    
    """
    Update a shared dashboard with selectable_template_vars 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.selectable_template_variable_items import SelectableTemplateVariableItems
    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,
        selectable_template_vars=[
            SelectableTemplateVariableItems(
                default_value="*",
                name="group_by_var",
                type="group",
                visible_tags=[
                    "selectableValue1",
                    "selectableValue2",
                ],
            ),
        ],
    )
    
    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.comap2.datadoghq.comddog-gov.comus2.ddog-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)
    
    # Update a shared dashboard with selectable_template_vars 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,
      selectable_template_vars: [
        DatadogAPIClient::V1::SelectableTemplateVariableItems.new({
          default_value: "*",
          name: "group_by_var",
          type: "group",
          visible_tags: [
            "selectableValue1",
            "selectableValue2",
          ],
        }),
      ],
    })
    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.comap2.datadoghq.comddog-gov.comus2.ddog-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()
            .global_time(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());
        }
    }
    
    // Update a shared dashboard with selectable_template_vars 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::SelectableTemplateVariableItems;
    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()
            .global_time(Some(
                SharedDashboardUpdateRequestGlobalTime::new()
                    .live_span(DashboardGlobalTimeLiveSpan::PAST_FIFTEEN_MINUTES),
            ))
            .selectable_template_vars(Some(vec![SelectableTemplateVariableItems::new()
                .default_value("*".to_string())
                .name("group_by_var".to_string())
                .type_(Some("group".to_string()))
                .visible_tags(Some(vec![
                    "selectableValue1".to_string(),
                    "selectableValue2".to_string(),
                ]))]))
            .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.comap2.datadoghq.comddog-gov.comus2.ddog-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));
    
    /**
     * Update a shared dashboard with selectable_template_vars 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",
        selectableTemplateVars: [
          {
            defaultValue: "*",
            name: "group_by_var",
            type: "group",
            visibleTags: ["selectableValue1", "selectableValue2"],
          },
        ],
      },
      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.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"