For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/es/api/latest/widgets/update-a-widget.md. A documentation index is available at /llms.txt.
Language
Datadog site

Update a widget

PUThttps://api.datadoghq.com/api/v2/widgets/{experience_type}/{uuid}https://api.us3.datadoghq.com/api/v2/widgets/{experience_type}/{uuid}https://api.us5.datadoghq.com/api/v2/widgets/{experience_type}/{uuid}https://api.datadoghq.eu/api/v2/widgets/{experience_type}/{uuid}https://api.ap1.datadoghq.com/api/v2/widgets/{experience_type}/{uuid}https://api.ap2.datadoghq.com/api/v2/widgets/{experience_type}/{uuid}https://api.uk1.datadoghq.com/api/v2/widgets/{experience_type}/{uuid}https://api.ddog-gov.com/api/v2/widgets/{experience_type}/{uuid}https://api.us2.ddog-gov.com/api/v2/widgets/{experience_type}/{uuid}

Descripción general

Update a widget by its UUID for a given experience type. This performs a full replacement of the widget definition.

This endpoint requires any of the following permissions:

  • cloud_cost_management_write
  • generate_log_reports
  • manage_log_reports
  • product_analytics_saved_widgets_write

Argumentos

Parámetros de ruta

Nombre
Type
Descripción
experience_type [required]
enum

The experience type for the widget.

Allowed enum values: ccm_reports, logs_reports, csv_reports, product_analytics
uuid [required]
string

The UUID of the widget.

Solicitud

Body Data (required)

Widget request body. The definition object's required fields vary by widget.definition.type; see CreateWidget above for a complete worked payload. Update is a full replacement of the widget definition.

Campo
Type
Descripción
data [required]
object

Data for creating or updating a widget.

Respuesta

OK

Response containing a single widget.

Campo
Type
Descripción
data [required]
object

A widget resource object.

included
[object]

Array of user resources related to the widget.

Ejemplo de código

Update a widget
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "definition": {
        "graph_options": [
          {
            "type": "query_value",
            "view": "total"
          },
          {
            "type": "query_value",
            "view": "change"
          },
          {
            "display_type": "bars",
            "type": "timeseries"
          },
          {
            "type": "cloud_cost_table",
            "view": "summary"
          }
        ],
        "requests": [
          {
            "formulas": [
              {
                "formula": "query1"
              }
            ],
            "queries": [
              {
                "data_source": "cloud_cost",
                "name": "query1",
                "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)"
              }
            ],
            "response_format": "timeseries"
          }
        ],
        "time": {
          "type": "live",
          "unit": "day",
          "value": 30
        },
        "title": "AWS spend by service (last 30 days)",
        "type": "cloud_cost_summary"
      },
      "tags": [
        "finops",
        "aws"
      ]
    },
    "type": "widgets"
  }
}
EOF