Add Widget to Dashboard
Create a new widget, append it to the dashboard, and compute its result in one call.
The widget is persisted as its own entity, its ID is appended to the dashboard’s
widget_order, and — unless it is a markdown or heading widget — its result is
computed synchronously against the dashboard’s evaluation (or evaluation-group) data
before the response returns. Validation is type-specific: markdown requires
config.content, bar/histogram/donut/scatter require exactly one of
config.x_column or config.x_column_group, table configs with conditional
formatting are schema-validated, and all other chart types require a query. The
dashboard must exist and not be archived. A computation failure does not fail the
request: the widget is still created and returned with a result whose
computation_status is failed and an error_message set, while markdown and
heading widgets return a null result.
Add Widget to Dashboard
curl https://api.egp.scale.com/v5/evaluation-dashboards/$DASHBOARD_ID/widgets \
-H 'Content-Type: application/json' \
-H "x-api-key: $SGP_API_KEY" \
-d '{
"title": "x",
"type": "bar"
}'{
"id": "id",
"account_id": "account_id",
"created_at": "2019-12-27T18:11:19.117Z",
"title": "title",
"type": "bar",
"config": {
"foo": "bar"
},
"object": "evaluation_widget",
"query": {
"select": [
{
"expression": {
"column": "column",
"source": "source",
"type": "COLUMN"
},
"alias": "alias"
}
],
"evaluation_ids": [
"string"
],
"filter": {
"conditions": [
{
"column": "column",
"operator": "=",
"source": "source",
"value": "string"
}
],
"logicalOperators": [
"AND"
]
},
"groupBy": [
"string"
],
"latest_only": true,
"limit": 1,
"orderBy": [
{
"column": "column",
"direction": "ASC",
"source": "source"
}
]
},
"result": {
"id": "id",
"computation_status": "computation_status",
"widget_id": "widget_id",
"computed_at": "2019-12-27T18:11:19.117Z",
"computed_result": {
"foo": "bar"
},
"error_message": "error_message"
}
}Returns Examples
{
"id": "id",
"account_id": "account_id",
"created_at": "2019-12-27T18:11:19.117Z",
"title": "title",
"type": "bar",
"config": {
"foo": "bar"
},
"object": "evaluation_widget",
"query": {
"select": [
{
"expression": {
"column": "column",
"source": "source",
"type": "COLUMN"
},
"alias": "alias"
}
],
"evaluation_ids": [
"string"
],
"filter": {
"conditions": [
{
"column": "column",
"operator": "=",
"source": "source",
"value": "string"
}
],
"logicalOperators": [
"AND"
]
},
"groupBy": [
"string"
],
"latest_only": true,
"limit": 1,
"orderBy": [
{
"column": "column",
"direction": "ASC",
"source": "source"
}
]
},
"result": {
"id": "id",
"computation_status": "computation_status",
"widget_id": "widget_id",
"computed_at": "2019-12-27T18:11:19.117Z",
"computed_result": {
"foo": "bar"
},
"error_message": "error_message"
}
}