Dashboards API
대시보드 관리를 위한 API입니다.
개요
Dashboards API를 통해 대시보드를 생성, 조회, 수정, 삭제할 수 있습니다. 대시보드는 여러 위젯으로 구성되며, 데이터 시각화 및 모니터링에 사용됩니다.
엔드포인트
GET /api/v1/dashboards/
모든 대시보드 목록을 조회합니다.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 100 | 최대 조회 개수 |
token | string | - | 페이지네이션 토큰 |
Response
200 OK
{
"items": {
"dashboard-abc123": "{\"id\":\"dashboard-abc123\",\"name\":\"Sales Dashboard\",...}",
"dashboard-xyz789": "{\"id\":\"dashboard-xyz789\",\"name\":\"Marketing Dashboard\",...}"
},
"token": "next-page-token"
}
GET /api/v1/dashboards/{dashboard_id}/versions
대시보드의 버전 히스토리를 조회합니다.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dashboard_id | string | Yes | 대시보드 ID |
Response
200 OK
[
{
"version_id": "v3",
"last_modified": "2024-01-20T10:30:00Z",
"size": 4096
},
{
"version_id": "v2",
"last_modified": "2024-01-19T15:00:00Z",
"size": 3584
}
]
GET /api/v1/dashboards/{dashboard_id}
특정 대시보드를 조회합니다.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dashboard_id | string | Yes | 대시보드 ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dashboard_version | string | No | 특정 버전 조회 |
Response
200 OK
{
"id": "dashboard-abc123",
"name": "Sales Dashboard",
"description": "Monthly sales overview",
"widgets": [
{
"id": "widget-1",
"type": "bar_chart",
"title": "Revenue by Category",
"position": {"x": 0, "y": 0, "w": 6, "h": 4},
"config": {
"dataSource": "dataset-sales",
"xField": "category",
"yField": "revenue"
}
}
],
"groups": [],
"tags": ["sales", "monthly"],
"owner": "user-admin",
"shared": true,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-20T10:30:00Z"
}
POST /api/v1/dashboards/
새 대시보드를 생성합니다.
Request Body
{
"name": "Sales Dashboard",
"description": "Monthly sales overview",
"widgets": [],
"tags": ["sales"],
"owner": "user-admin",
"shared": false
}
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | 대시보드 이름 |
description | string | No | 설명 |
widgets | array | No | 위젯 목록 |
tags | array | No | 태그 목록 |
owner | string | No | 소유자 ID |
shared | boolean | No | 공유 여부 (기본: false) |
Response
200 OK
{
"item": "dashboard-abc123"
}
PUT /api/v1/dashboards/{dashboard_id}
대시보드를 수정합니다.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dashboard_id | string | Yes | 대시보드 ID |
Request Body
수정할 필드만 포함합니다.
{
"name": "Updated Dashboard Name",
"widgets": [...],
"shared": true
}
| Field | Type | Description |
|---|---|---|
name | string | 대시보드 이름 |
description | string | 설명 |
widgets | array | 위젯 목록 |
groups | array | 그룹 목록 |
tags | array | 태그 목록 |
owner | string | 소유자 ID |
shared | boolean | 공유 여부 |
comment | string | 버전 코멘트 |
Response
200 OK
{
"message": "Dashboard updated successfully"
}
DELETE /api/v1/dashboards/{dashboard_id}
대시보드를 삭제합니다.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dashboard_id | string | Yes | 대시보드 ID |
Response
200 OK
{
"message": "Dashboard deleted successfully"
}
위젯 구조
{
"id": "widget-uuid",
"type": "bar_chart",
"title": "Widget Title",
"position": {
"x": 0,
"y": 0,
"w": 6,
"h": 4
},
"config": {
"dataMode": "simple",
"dataSource": "dataset-id",
"xField": "category",
"yField": "value",
"aggregation": "sum"
}
}
위젯 타입
| Type | Description |
|---|---|
statistic_card | 통계 카드 |
bar_chart | 막대 차트 |
line_chart | 선 차트 |
pie_chart | 파이 차트 |
heatmap | 히트맵 |
gauge | 게이지 |
data_table | 데이터 테이블 |
map | 지도 |
사용 예시
cURL
# 대시보드 목록 조회
curl https://api.dhub.io/api/v1/dashboards/ \
-H "Authorization: Bearer <access_token>"
# 대시보드 생성
curl -X POST https://api.dhub.io/api/v1/dashboards/ \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My Dashboard",
"description": "Dashboard description",
"widgets": [],
"shared": false
}'
# 대시보드 수정
curl -X PUT https://api.dhub.io/api/v1/dashboards/dashboard-abc123 \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Name", "shared": true}'
# 대시보드 삭제
curl -X DELETE https://api.dhub.io/api/v1/dashboards/dashboard-abc123 \
-H "Authorization: Bearer <access_token>"