If receive an error "Authorization Denied", check policy Dashboard / Create and Edit in Access Management.
const result = await Resources.dashboards.widgets.create("dashboard-id-123", {
data : [{
origin: "origin-id-123",
query: "last_value",
variables: ["temperature"]
}],
display: {
show_units: true,
show_variables: true,
variables: [{
origin: "origin-id-123",
variable: "temperature"
}]
},
label: "Temperature",
type: "display",
});
console.log(result); // { widget: "widget-id-456" }
// To add the widget size to the dashboard
// Before running this, make sure doesn't have more widgets in the dashboard.
await Resources.dashboards.edit("dashboard-id-123", {
arrangement: [{ widget_id: result.widget, width: 1, height: 2, minW: 1, minH: 2, x: 0, y: 0 }]
});
Permanently removes a widget from a dashboard.
If receive an error "Authorization Denied", check policy Dashboard / Delete and Edit in Access Management.
const result = await Resources.dashboards.widgets.delete("dashboard-id-123", "widget-id-456");
console.log(result); // Successfully Removed
// To remove sizes from all widgets from a dashboard
// Before running this, make sure doesn't have more widgets in the dashboard.
await Resources.dashboards.edit("dashboard-id-123", { arrangement: [] });
Updates an existing widget's configuration on a dashboard.
Updates existing data values for a specific widget.
Updates resource values associated with the widget.
Optional
options: EditResourceOptionsRetrieves data or resource list for a specific widget based on the given parameters.
Optional
params: GetDataModelconst resources = new Resources({ token: "YOUR-PROFILE-TOKEN" });
const result = await resources.dashboards.widgets.getData("dashboard-id-123", "widget-id-456", {
start_date: "2025-01-01",
end_date: "2025-12-31",
timezone: "UTC"
});
console.log(result); // { widget: { analysis_run: null, dashboard: '6791456f8b726c0009adccec', ... }, ...}
Retrieves detailed information about a specific widget.
Sends new data values to be displayed in the widget.
Generates a new authentication token for embedding a widget. Each call regenerates the token.
Creates a new widget for a specified dashboard with the given configuration.