Skip to main content

widgets

Creates, updates, deletes, gets or lists a widgets resource.

Overview

Namewidgets
TypeResource
Iddatadog.dashboards.widgets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the widget. (example: a1b2c3d4-e5f6-7890-abcd-ef1234567890)
attributesobjectAttributes of a widget resource.
relationshipsobjectRelationships of the widget resource.
typestringWidgets resource type. (example: widgets)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_widgetselectexperience_type, uuidRetrieve a widget by its UUID for a given experience type.
search_widgetsselectexperience_typefilter[widget_type], filter[creator_handle], filter[is_favorited], filter[title], filter[tags], sort, page[number], page[size]Search and list widgets for a given experience type, with filtering, sorting, and pagination.<br /><br />Response meta carries totals scoped to the current filter:<br />- filtered_total — widgets matching the filter.<br />- created_by_you_total — among the matches, how many the current user created.<br />- favorited_by_you_total — among the matches, how many the current user has favorited.<br />- created_by_anyone_total — total widgets in the experience type, ignoring filters.<br /><br />Each returned widget includes is_favorited reflecting the current user's favorite status.<br />Favoriting itself is performed through the shared favorites API, not this endpoint.
create_widgetinsertexperience_type, dataCreate a new widget for a given experience type.
update_widgetreplaceexperience_type, uuid, dataUpdate a widget by its UUID for a given experience type. This performs a full replacement of the widget definition.
delete_widgetdeleteexperience_type, uuidSoft-delete a widget by its UUID for a given experience type.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
experience_typestringThe experience type for the widget.
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.
uuidstring (uuid)The UUID of the widget.
filter[creator_handle]stringFilter widgets by the email handle of the creator. (wire: filter[creatorHandle])
filter[is_favorited]booleanFilter to only widgets favorited by the current user. (wire: filter[isFavorited])
filter[tags]stringFilter widgets by tags. Format as bracket-delimited CSV, e.g. &#91;tag1,tag2&#93;.
filter[title]stringFilter widgets by title (substring match).
filter[widget_type]stringFilter widgets by widget type. (wire: filter[widgetType])
page[number]integer (int64)Page number for pagination (0-indexed).
page[size]integer (int64)Number of widgets per page.
sortstringSort field for the results. title, created_at, modified_at — both ascending and descending are supported. Use the bare field name for ascending (e.g. sort=title) or prefix with - for descending (e.g. sort=-modified_at). is_favorited — returns favorites-first ordering (favorited widgets first, then the rest). Direction is fixed; the - prefix is ignored for this field.

SELECT examples

Retrieve a widget by its UUID for a given experience type.

SELECT
id,
attributes,
relationships,
type
FROM datadog.dashboards.widgets
WHERE experience_type = '{{ experience_type }}' -- required
AND uuid = '{{ uuid }}' -- required
;

INSERT examples

Create a new widget for a given experience type.

INSERT INTO datadog.dashboards.widgets (
data,
experience_type
)
SELECT
'{{ data }}' /* required */,
'{{ experience_type }}'
RETURNING
data,
included
;

REPLACE examples

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

REPLACE datadog.dashboards.widgets
SET
data = '{{ data }}'
WHERE
experience_type = '{{ experience_type }}' --required
AND uuid = '{{ uuid }}' --required
AND data = '{{ data }}' --required
RETURNING
data,
included;

DELETE examples

Soft-delete a widget by its UUID for a given experience type.

DELETE FROM datadog.dashboards.widgets
WHERE experience_type = '{{ experience_type }}' --required
AND uuid = '{{ uuid }}' --required
;