Skip to main content
The updateDashboardWidgets mutation updates multiple existing widgets on a dashboard in a single operation. This allows for bulk updates to widget properties such as titles, layouts, and other configurations.

Signature

updateDashboardWidgets(widgets: [DashboardWidgetInput!]): Dashboard!

Arguments

widgets
[DashboardWidgetInput!]!
required
Array of widget input objects containing the updates to apply. Each widget must include an id field to identify which widget to update. See DashboardWidgetInput for the complete schema.

Response

Returns the updated Dashboard object with all widgets populated, including the updated widget configurations. See Dashboard for the schema.

Usage Example

The following example shows how to update multiple widget properties on a dashboard:
mutation UpdateDashboardWidgets($widgets: [DashboardWidgetInput!]) {
  updateDashboardWidgets(widgets: $widgets) {
    id
    version
    name
    widgets {
      id
      title
      nlQuery
      layout {
        top
        left
        width
        height
      }
      widgetType
    }
  }
}
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <jwt_token>" \
  -d '{
    "query": "mutation UpdateDashboardWidgets($widgets: [DashboardWidgetInput!]) { updateDashboardWidgets(widgets: $widgets) { id version name widgets { id title nlQuery layout { top left width height } widgetType } } }",
    "variables": {
      "widgets": [
        {
          "id": "widget_123456789",
          "title": "Updated Revenue Chart",
          "nlQuery": "Show monthly revenue by region"
        },
        {
          "id": "widget_987654321",
          "layout": {
            "top": 6,
            "left": 4,
            "width": 8,
            "height": 6
          }
        }
      ]
    }
  }' \
  https://{ACCOUNT}.askwisdom.ai/graphql
{
  "data": {
    "updateDashboardWidgets": {
      "id": "dashboard_abcdef123456",
      "version": "v1.2",
      "name": "Sales Dashboard",
      "widgets": [
        {
          "id": "widget_123456789",
          "title": "Updated Revenue Chart",
          "nlQuery": "Show monthly revenue by region",
          "layout": {
            "top": 0,
            "left": 0,
            "width": 6,
            "height": 4
          },
          "widgetType": "WIDGET_TYPE_VISUALIZATION"
        },
        {
          "id": "widget_987654321",
          "title": "Customer Count",
          "nlQuery": "Total customers",
          "layout": {
            "top": 6,
            "left": 4,
            "width": 8,
            "height": 6
          },
          "widgetType": "WIDGET_TYPE_SUMMARY"
        }
      ]
    }
  }
}