ReferenceReference by module

Dashboards API

Every Dashboards action (6) and data model (2): endpoints, scopes, input, preconditions, events and examples.

Dashboards of numbers, charts and tables built from your Base tables and your reports.

Module code dashboards · 6 actions · 2 data models · 3 events. A key or token never does more here than the person behind it can; row-level security applies exactly as in the app. Scopes: dashboards (everything), dashboards:read (read only) or dashboards:<capability>.

Resources

ResourceTableList and readPOSTPATCHDELETE
dashboard_widgetsdashboard_widget/api/v1/dashboard_widgets
dashboardsdashboard/api/v1/dashboardsdashboards.create_dashboarddashboards.update_dashboarddashboards.delete_dashboard

Lists take limit (up to 200), cursor, order (e.g. -created_at), fields and q; every other query parameter is a column filter: ?status=paid, ?total[gte]=100, ?id[in]=a,b, ?x=null.

Actions

ActionNeedsWhat it does
dashboards.arrange_widgetsdashboards:writeRearrange widgets
dashboards.create_dashboarddashboards:writeNew dashboard
dashboards.delete_dashboarddashboards:deleteDelete a dashboard
dashboards.remove_widgetdashboards:writeRemove a widget
dashboards.save_widgetdashboards:writeAdd or edit a widget
dashboards.update_dashboarddashboards:writeRename a dashboard

dashboards.arrange_widgets

Rearrange widgets — Puts a board’s widgets in a new order.

Needs dashboards:write · changes data

POSThttps://app.getera.io/api/v1/dashboard_widgets/actions/arrange_widgets
API key or OAuth token · dashboards:write
  • Canonical address: POST /api/v1/actions/dashboards.arrange_widgets

Input

FieldTypeRequiredNotes
dashboardIduuidyesDashboard · id of dashboard
orderobject / arrayyesOrder

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
dashboard_not_foundThe dashboard must exist.

Events it publishes: dashboards.dashboard_changed

What it writes: dashboard_widget (update) — Renumbers the widgets

curl -X POST https://app.getera.io/api/v1/dashboard_widgets/actions/arrange_widgets \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"dashboardId":"DASHBOARD_ID","order":{}}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "dashboards.dashboard_changed"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dashboardWidgets.arrangeWidgets({
  dashboardId: "DASHBOARD_ID",
  order: {}
})
era dashboard_widgets arrange_widgets --data '{"dashboardId":"DASHBOARD_ID","order":{}}'
tools/call
{
  "name": "era__dashboards__arrange_widgets",
  "arguments": {
    "dashboardId": "DASHBOARD_ID",
    "order": {}
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold dashboards:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 dashboard_not_found · 429 slow down

dashboards.create_dashboard

New dashboard — Opens an empty board to put figures and charts on.

Needs dashboards:write · changes data

POSThttps://app.getera.io/api/v1/dashboards/actions/create_dashboard
API key or OAuth token · dashboards:write
  • REST alias: POST /api/v1/dashboards
  • Canonical address: POST /api/v1/actions/dashboards.create_dashboard

Input

FieldTypeRequiredNotes
titlestringyesName · max 200
descriptionstringDescription · max 2000

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
title_requiredA dashboard needs a name.
name_takenTwo dashboards may not share a name.

Events it publishes: dashboards.dashboard_created

What it writes: dashboard (insert) — Creates the board

curl -X POST https://app.getera.io/api/v1/dashboards/actions/create_dashboard \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"title":"Name"}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "dashboards.dashboard_created"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dashboards.create({
  title: "Name"
})
era dashboards create \
  --title "Name"
tools/call
{
  "name": "era__dashboards__create_dashboard",
  "arguments": {
    "title": "Name"
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold dashboards:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 title_required, name_taken · 429 slow down

dashboards.delete_dashboard

Delete a dashboard — Removes a board and its widgets. The tables it read are untouched.

Needs dashboards:delete · removes or cannot be undone · asks a person to confirm when Era runs it

POSThttps://app.getera.io/api/v1/dashboards/{id}/actions/delete_dashboard
API key or OAuth token · dashboards:delete
  • REST alias: DELETE /api/v1/dashboards/{id}
  • Canonical address: POST /api/v1/actions/dashboards.delete_dashboard

Input

FieldTypeRequiredNotes
iduuidyesFilled from the path {id} · Dashboard · id of dashboard

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
dashboard_not_foundThe dashboard must exist.

Events it publishes: dashboards.dashboard_deleted

What it writes: dashboard (delete) — Deletes the board; dashboard_widget (delete) — And every widget on it

curl -X POST https://app.getera.io/api/v1/dashboards/DASHBOARD_ID/actions/delete_dashboard \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "dashboards.dashboard_deleted"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dashboards.deleteDashboard("DASHBOARD_ID")
era dashboards delete_dashboard DASHBOARD_ID
tools/call
{
  "name": "era__dashboards__delete_dashboard",
  "arguments": {
    "id": "DASHBOARD_ID"
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold dashboards:delete · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 dashboard_not_found · 429 slow down

dashboards.remove_widget

Remove a widget — Takes one widget off its board.

Needs dashboards:write · removes or cannot be undone · asks a person to confirm when Era runs it

POSThttps://app.getera.io/api/v1/dashboard_widgets/{id}/actions/remove_widget
API key or OAuth token · dashboards:write
  • Canonical address: POST /api/v1/actions/dashboards.remove_widget

Input

FieldTypeRequiredNotes
iduuidyesFilled from the path {id} · Widget · id of dashboard_widget

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
widget_not_foundThe widget must exist.

Events it publishes: dashboards.dashboard_changed

What it writes: dashboard_widget (delete) — Deletes the widget

curl -X POST https://app.getera.io/api/v1/dashboard_widgets/DASHBOARD_WIDGET_ID/actions/remove_widget \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "dashboards.dashboard_changed"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dashboardWidgets.removeWidget("DASHBOARD_WIDGET_ID")
era dashboard_widgets remove_widget DASHBOARD_WIDGET_ID
tools/call
{
  "name": "era__dashboards__remove_widget",
  "arguments": {
    "id": "DASHBOARD_WIDGET_ID"
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold dashboards:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 widget_not_found · 429 slow down

dashboards.save_widget

Add or edit a widget — Puts a figure, chart, table or note on a board, reading one Base table or view, or one of the modules’ reports.

Needs dashboards:write · changes data

POSThttps://app.getera.io/api/v1/dashboard_widgets/{id}/actions/save_widget
API key or OAuth token · dashboards:write
  • Canonical address: POST /api/v1/actions/dashboards.save_widget

Input

FieldTypeRequiredNotes
dashboardIduuidyesDashboard · id of dashboard
iduuidFilled from the path {id} · Widget · id of dashboard_widget
kindstring (enum)yesKind · Allowed values: metric, bar, line, donut, table, text
titlestringyesTitle · max 200
dataTableIduuidTable · id of data_table
savedViewIduuidView · id of saved_view
datasetKeystringReport · max 120
configobject / arraySettings
widthnumberWidth · min 1 · max 4

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
dashboard_not_foundThe dashboard must exist.
widget_not_foundAn edited widget must be on this dashboard.
source_table_not_foundA data widget reads a Base table, and a view of that table.
dataset_not_foundA report widget reads a report this workspace has and the builder can open.
invalid_widget_configThe fields a widget sums or groups by must suit it.

Events it publishes: dashboards.dashboard_changed

What it writes: dashboard_widget (upsert) — Writes the widget

curl -X POST https://app.getera.io/api/v1/dashboard_widgets/DASHBOARD_WIDGET_ID/actions/save_widget \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"dashboardId":"DASHBOARD_ID","kind":"metric","title":"Title"}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "dashboards.dashboard_changed"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dashboardWidgets.saveWidget("DASHBOARD_WIDGET_ID", {
  dashboardId: "DASHBOARD_ID",
  kind: "metric",
  title: "Title"
})
era dashboard_widgets save_widget DASHBOARD_WIDGET_ID \
  --dashboard-id "DASHBOARD_ID" \
  --kind "metric" \
  --title "Title"
tools/call
{
  "name": "era__dashboards__save_widget",
  "arguments": {
    "id": "DASHBOARD_WIDGET_ID",
    "dashboardId": "DASHBOARD_ID",
    "kind": "metric",
    "title": "Title"
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold dashboards:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 dashboard_not_found, widget_not_found, source_table_not_found, dataset_not_found, invalid_widget_config · 429 slow down

dashboards.update_dashboard

Rename a dashboard — Changes a board’s name or description.

Needs dashboards:write · changes data

POSThttps://app.getera.io/api/v1/dashboards/{id}/actions/update_dashboard
API key or OAuth token · dashboards:write
  • REST alias: PATCH /api/v1/dashboards/{id}
  • Canonical address: POST /api/v1/actions/dashboards.update_dashboard

Input

FieldTypeRequiredNotes
iduuidyesFilled from the path {id} · Dashboard · id of dashboard
titlestringName · max 200
descriptionstringDescription · max 2000

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
dashboard_not_foundThe dashboard must exist.
name_takenTwo dashboards may not share a name.
no_changeSomething has to change.

Events it publishes: dashboards.dashboard_changed

What it writes: dashboard (update) — Renames the board

curl -X POST https://app.getera.io/api/v1/dashboards/DASHBOARD_ID/actions/update_dashboard \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"title":"Name"}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "dashboards.dashboard_changed"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.dashboards.updateDashboard("DASHBOARD_ID", {
  title: "Name"
})
era dashboards update_dashboard DASHBOARD_ID \
  --title "Name"
tools/call
{
  "name": "era__dashboards__update_dashboard",
  "arguments": {
    "id": "DASHBOARD_ID",
    "title": "Name"
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold dashboards:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 dashboard_not_found, name_taken, no_change · 429 slow down

Data models

DashboardWidget

Table dashboard_widget · Resource dashboard_widgets

  • GET /api/v1/dashboard_widgets
  • GET /api/v1/dashboard_widgets/{id}
ColumnTypeNullableAllowed valuesReferences
idstring (uuid) · uuid
organization_idstring (uuid) · uuidorganization
workspace_idstring (uuid) · uuidworkspace
dashboard_idstring (uuid) · uuiddashboard
kindstring · textmetric, bar, line, donut, table, text
titlestring · text
data_table_idstring (uuid) · uuidyes
saved_view_idstring (uuid) · uuidyes
configobject · jsonb
widthinteger · int2
positionnumber · float8
created_atstring (date-time) · timestamptz
updated_atstring (date-time) · timestamptz
dataset_keystring · textyes

Primary key: id

Checks:

  • CHECK ((jsonb_typeof(config) = 'object'::text))
  • CHECK (((dataset_key IS NULL) OR (dataset_key ~ '^[a-z0-9_]+\.[a-z0-9_]+$'::text)))
  • CHECK (((kind = 'text'::text) OR (data_table_id IS NOT NULL) OR (dataset_key IS NOT NULL)))
  • CHECK (((width >= 1) AND (width <= 4)))

Dashboard

Table dashboard · Resource dashboards

ColumnTypeNullableAllowed valuesReferences
idstring (uuid) · uuid
organization_idstring (uuid) · uuidorganization
workspace_idstring (uuid) · uuidworkspace
titlestring · text
descriptionstring · textyes
sort_ordernumber · float8
created_bystring (uuid) · uuidyesapp_user
created_atstring (date-time) · timestamptz
updated_atstring (date-time) · timestamptz

Primary key: id

Checks:

  • CHECK ((btrim(title) <> ''::text))

Events

Workflows and webhooks react to these events.

EventWhat happensPayload
dashboards.dashboard_changedA dashboard or its widgets changed.id
dashboards.dashboard_createdA dashboard was created.id
dashboards.dashboard_deletedA dashboard was deleted.id
Was this page helpful?