Hierarchy

Constructors

Methods

  • Parameters

    Returns Promise<{
        widget: string;
    }>

    Description

    Creates a new widget for a specified dashboard with the given configuration.

    Example

    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 }]
    });
  • Parameters

    • dashboardID: string
    • widgetID: string

    Returns Promise<string>

    Description

    Permanently removes a widget from a dashboard.

    Example

    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: [] });
  • Parameters

    • dashboardID: string
    • widgetID: string
    • variableID: string
    • deviceID: string

    Returns Promise<string>

    Description

    Removes specific data points from the widget by their IDs.

    Example

    const resources = new Resources({ token: "YOUR-PROFILE-TOKEN" });
    const result = await resources.dashboards.widgets.deleteData(
    "dashboard-id-123", "widget-id-456", "data-id-789", "device-id-123"
    );
    console.log(result); // Widget Data Removed
  • Parameters

    • dashboardID: string
    • widgetID: string
    • data: Partial<WidgetInfo>

    Returns Promise<string>

    Description

    Updates an existing widget's configuration on a dashboard.

    Example

    If receive an error "Authorization Denied", check policy Dashboard / Edit in Access Management.

    const result = await Resources.dashboards.widgets.edit("dashboard-id-123", "widget-id-456", {
    label: "Updated Temperature",
    });
    console.log(result); // Successfully Updated
  • Parameters

    Returns Promise<object>

    Description

    Updates existing data values for a specific widget.

    Example

    const resources = new Resources({ token: "YOUR-PROFILE-TOKEN" });
    const result = await resources.dashboards.widgets.editData("dashboard-id-123", "widget-id-456", {
    origin: "origin-id-123",
    id: "data-id-789",
    value: 25.5
    });
    console.log(result); // Device Data Updated
  • Parameters

    • dashboardID: string
    • widgetID: string
    • Optional params: GetDataModel

    Returns Promise<object>

    Description

    Retrieves data or resource list for a specific widget based on the given parameters.

    Example

    const 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', ... }, ...}
  • Parameters

    • dashboardID: string
    • widgetID: string

    Returns Promise<WidgetInfo>

    Description

    Retrieves detailed information about a specific widget.

    Example

    If receive an error "Authorization Denied", check policy Dashboard / Access in Access Management.

    const result = await Resources.dashboards.widgets.info("dashboard-id-123", "widget-id-456");
    console.log(result); // { id: "widget-id-456", data: [ { query: "last_value", ... }, ... ], ... }
  • Parameters

    Returns Promise<object>

    Description

    Sends new data values to be displayed in the widget.

    Example

    const resources = new Resources({ token: "YOUR-PROFILE-TOKEN" });
    const result = await resources.dashboards.widgets.sendData("dashboard-id-123", "widget-id-456", {
    origin: "origin-id-123",
    variable: "temperature",
    value: 25.5,
    unit: "C"
    });
    console.log(result); // [ '1 Data Added' ]
  • Parameters

    • dashboardID: string
    • widgetID: string

    Returns Promise<{
        widget_token: string;
    }>

    Description

    Generates a new authentication token for embedding a widget. Each call regenerates the token.

    Example

    const resources = new Resources({ token: "YOUR-PROFILE-TOKEN" });
    const result = await resources.dashboards.widgets.tokenGenerate("dashboard-id-123", "widget-id-456");
    console.log(result); // { widget_token: "widget-token-123" }