curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <jwt_token>" \
  -d '{
    "query": "mutation AddWidgetToDashboard($id: String!, $widget: DashboardWidgetInput!) { addWidgetToDashboard(id: $id, widget: $widget) { id widgets { id title layout { top left width height } } } }",
    "variables": {
      "id": "dashboard_123456789",
      "widget": {
        "title": "Revenue Trend",
        "nlQuery": "Show revenue trend over time",
        "layout": {
          "top": 4,
          "left": 0,
          "width": 6,
          "height": 4
        }
      }
    }
  }' \
  https://{ACCOUNT}.askwisdom.ai/graphql
{
  "data": {
    "addWidgetToDashboard": {
      "id": "dashboard_123456789",
      "widgets": [
        {
          "id": "widget_987654321",
          "title": "Revenue Trend",
          "layout": {
            "top": 4,
            "left": 0,
            "width": 6,
            "height": 4
          }
        }
      ]
    }
  }
}
The addWidgetToDashboard mutation adds a new widget to an existing dashboard.

Signature

addWidgetToDashboard(id: String!, widget: DashboardWidgetInput!): Dashboard!

Arguments

id
String!
required
The unique identifier of the dashboard to add the widget to.
widget
DashboardWidgetInput!
required
Widget configuration for the new widget. See DashboardWidgetInput.

Response

Returns the updated Dashboard object with the new widget included. See Dashboard for the schema.

Usage Example

The following example shows how to add a new widget to an existing dashboard:
mutation AddWidgetToDashboard($id: String!, $widget: DashboardWidgetInput!) {
  addWidgetToDashboard(id: $id, widget: $widget) {
    id
    widgets {
      id
      title
      layout {
        top
        left
        width
        height
      }
    }
  }
}
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <jwt_token>" \
  -d '{
    "query": "mutation AddWidgetToDashboard($id: String!, $widget: DashboardWidgetInput!) { addWidgetToDashboard(id: $id, widget: $widget) { id widgets { id title layout { top left width height } } } }",
    "variables": {
      "id": "dashboard_123456789",
      "widget": {
        "title": "Revenue Trend",
        "nlQuery": "Show revenue trend over time",
        "layout": {
          "top": 4,
          "left": 0,
          "width": 6,
          "height": 4
        }
      }
    }
  }' \
  https://{ACCOUNT}.askwisdom.ai/graphql
{
  "data": {
    "addWidgetToDashboard": {
      "id": "dashboard_123456789",
      "widgets": [
        {
          "id": "widget_987654321",
          "title": "Revenue Trend",
          "layout": {
            "top": 4,
            "left": 0,
            "width": 6,
            "height": 4
          }
        }
      ]
    }
  }
}