Drift Widgets
Manage customizable dashboard widgets that display drift metrics and summaries.
Base path: /api/drift-widgets
Authentication: Bearer token required on all routes
List Widgets
GET /api/drift-widgets/
Scope: drifts:read
Get all dashboard widgets for the current user.
Response
{
"success": true,
"data": [
{
"_id": "widget1",
"title": "High Severity Drifts",
"type": "count",
"filters": { "severity": "high", "status": "detected" },
"order": 0,
"metric": 12,
"lastRefreshed": "2025-06-15T10:00:00.000Z"
}
]
}Example
curl -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/drift-widgets/Refresh All Widgets
POST /api/drift-widgets/refresh
Scope: drifts:read
Refresh metrics for all widgets.
Example
curl -X POST -H "Authorization: Bearer TOKEN" \
https://api.controlinfra.com/api/drift-widgets/refreshReorder Widgets
POST /api/drift-widgets/reorder
Scope: drifts:write
Update the display order of all widgets.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
order | string[] | Yes | Array of widget IDs in desired order |
Example
curl -X POST https://api.controlinfra.com/api/drift-widgets/reorder \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"order": ["widget2", "widget1", "widget3"]}'Get Widget
GET /api/drift-widgets/:id
Scope: drifts:read
Get a single widget by ID.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Widget ID |
Create Widget
POST /api/drift-widgets/
Scope: drifts:write
Create a new dashboard widget.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Widget display title |
type | string | Yes | Widget type (e.g., count, chart, list) |
filters | object | No | Drift filters for the widget |
Response
{
"success": true,
"data": {
"_id": "widget4",
"title": "AWS Security Drifts",
"type": "count",
"filters": { "resourceType": "aws_security_group" },
"order": 3
}
}Update Widget
PUT /api/drift-widgets/:id
Scope: drifts:write
Update a widget's configuration.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Widget ID |
Request Body
Same fields as Create Widget (all optional for update).
Delete Widget
DELETE /api/drift-widgets/:id
Scope: drifts:write
Delete a dashboard widget.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Widget ID |
Refresh Single Widget
POST /api/drift-widgets/:id/refresh
Scope: drifts:read
Refresh the metric for a single widget.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Widget ID |