Skip to content

Dashboards API

Quick Reference

  • Base URL: https://insights.omisell.com/api/v1/dashboards
  • Auth: Authorization: Omi <token>
  • Content-Type: application/json

Endpoints Overview

MethodEndpointMô tảAuth
GET/api/v1/dashboards/Danh sách dashboardsYes
POST/api/v1/dashboards/Tạo dashboardYes
GET/api/v1/dashboards/{id}Chi tiết dashboardYes
PATCH/api/v1/dashboards/{id}Cập nhật dashboardYes
DELETE/api/v1/dashboards/{id}Xoá dashboardYes
GET/api/v1/dashboards/{id}/widgetsDanh sách widgetsYes
POST/api/v1/dashboards/{id}/widgetsTạo widgetYes
PATCH/api/v1/dashboards/{id}/widgets/{wid}Cập nhật widgetYes
DELETE/api/v1/dashboards/{id}/widgets/{wid}Xoá widgetYes
POST/api/v1/dashboards/{id}/widgets/{wid}/refreshRefresh widget dataYes
GET/api/v1/dashboards/subscriptionsTất cả subscriptionsYes
GET/api/v1/dashboards/{id}/subscriptionsSubscriptions của dashboardYes
POST/api/v1/dashboards/{id}/subscriptionsTạo subscriptionYes
PATCH/api/v1/dashboards/subscriptions/{subId}Toggle subscriptionYes
DELETE/api/v1/dashboards/subscriptions/{subId}Xoá subscriptionYes

Dashboard CRUD

GET /api/v1/dashboards/

Danh sách tất cả dashboards user có quyền xem.

Response (200 OK): Dashboard[]

FieldTypeMô tả
idstringID dashboard
tenant_idstringID tenant
namestringTên dashboard
descriptionstring?Mô tả
created_bystringUser ID người tạo
created_by_namestringTên người tạo
is_sharedbooleanĐã chia sẻ?
shared_with_emailsstring[]?Email được chia sẻ
widget_idsstring[]Danh sách widget IDs
global_filter_presetsGlobalFilterPreset[]Bộ filter presets
active_preset_idstring?Preset đang active
created_atstringThời gian tạo (ISO)
updated_atstringThời gian cập nhật (ISO)

Source: (api.service.ts:160-162)

POST /api/v1/dashboards/

Tạo dashboard mới. Yêu cầu role Owner/Admin.

Request Body: DashboardCreateRequest

FieldTypeRequiredMô tả
namestringYesTên dashboard
descriptionstring?NoMô tả
is_sharedboolean?NoChia sẻ công khai (default: false)

Response (201 Created): Dashboard

Source: (api.service.ts:168-169)

PATCH /api/v1/dashboards/:id

Cập nhật dashboard (tên, mô tả, sharing, filter presets).

Request Body: Partial<Dashboard>

Response (200 OK): Dashboard (updated)

Source: (api.service.ts:172-173)

DELETE /api/v1/dashboards/:id

Xoá dashboard và tất cả widgets. Yêu cầu role Owner/Admin hoặc là người tạo.

Response: 204 No Content

Source: (api.service.ts:176-178)


Widget CRUD

GET /api/v1/dashboards/:id/widgets

Danh sách widgets của dashboard.

Response (200 OK): DashboardWidget[]

FieldTypeMô tả
idstringID widget
dashboard_idstringID dashboard
titlestringTiêu đề widget
widget_type'chart' | 'table' | 'kpi'Loại widget
display_size'small' | 'medium' | 'large' | 'full'Kích thước
data_source'live_insight' | 'snapshot'Nguồn dữ liệu
insight_codestring?Mã insight (nếu live)
granularitystring?Mức thời gian
widget_filtersRecord<string, unknown>?Bộ lọc riêng
snapshot_dataDataRow[]?Dữ liệu snapshot
snapshot_chart_hintChartHint?Chart hint cho snapshot
snapshot_questionstring?Câu hỏi AI gốc
chart_hintChartHint?Chart hint hiện tại
chart_hint_override{ chart_type?: ChartType }?Override chart type
created_atstringThời gian tạo
last_refreshed_atstring?Lần refresh cuối

Source: (api.service.ts:181-184)

POST /api/v1/dashboards/:id/widgets

Tạo widget mới.

Request Body: DashboardWidgetCreateRequest

FieldTypeRequiredDefaultMô tả
titlestringYesTiêu đề
widget_typestringYeschart, table, kpi
display_sizestring?Nomediumsmall, medium, large, full
data_sourcestringYeslive_insight hoặc snapshot
insight_codestring?NoMã insight (khi live)
granularitystring?NoMức thời gian
widget_filtersobject?NoBộ lọc
snapshot_dataDataRow[]?NoDữ liệu snapshot
snapshot_chart_hintChartHint?NoChart hint cho snapshot
snapshot_questionstring?NoCâu hỏi AI gốc
chart_hintChartHint?NoChart hint

Response (201 Created): DashboardWidget

Source: (api.service.ts:187-194)

POST /api/v1/dashboards/:id/widgets/:wid/refresh

Refresh dữ liệu widget (chỉ áp dụng cho live_insight).

Request Body (optional):

FieldTypeMô tả
granularitystring?Override granularity
filtersRecord<string, unknown>?Override filters

Response (200 OK): ExecuteResponse

Source: (api.service.ts:214-223)


Dashboard Subscriptions (Scheduled Reports)

GET /api/v1/dashboards/subscriptions

Lấy tất cả dashboard subscriptions (cho trang Settings).

Response (200 OK): DashboardSubscription[]

Source: (api.service.ts:232-235)

GET /api/v1/dashboards/:id/subscriptions

Lấy subscriptions của một dashboard cụ thể.

Response (200 OK): DashboardSubscription[]

FieldTypeMô tả
idstringID subscription
dashboard_idstringID dashboard
dashboard_namestringTên dashboard
channel_idsstring[]Danh sách channel IDs
schedule'daily' | 'weekly' | 'monthly'Tần suất
schedule_timestringGiờ gửi (HH:mm, UTC)
schedule_day_of_weeknumber?0=CN, 1=T2...6=T7 (weekly)
schedule_day_of_monthnumber?1-31 (monthly)
is_activebooleanĐang hoạt động?
created_atstringThời gian tạo

Source: (api.service.ts:226-229)

POST /api/v1/dashboards/:id/subscriptions

Tạo scheduled report cho dashboard.

Request Body: DashboardSubscriptionCreateRequest

FieldTypeRequiredMô tả
dashboard_idstringYesID dashboard
dashboard_namestringYesTên dashboard
channel_idsstring[]YesKênh nhận
schedulestringYesdaily, weekly, monthly
schedule_timestringYesGiờ gửi (HH:mm UTC)
schedule_day_of_weeknumber?weekly only0-6
schedule_day_of_monthnumber?monthly only1-31

Response (201 Created): DashboardSubscription

Source: (api.service.ts:238-245)

PATCH /api/v1/dashboards/subscriptions/:subId

Toggle subscription on/off.

Request Body: { "is_active": boolean }

Source: (api.service.ts:247-251)

DELETE /api/v1/dashboards/subscriptions/:subId

Xoá subscription.

Response: 204 No Content

Source: (api.service.ts:254-257)

Liên kết

Hệ thống tài liệu Boxme AI Insight — Powered by CodyMaster DocKit