|
| 1 | +# API reference |
| 2 | + |
| 3 | +All `/api/*` routes except login require an authenticated session cookie. Admin-only HyperbyteDB operations still require admin credentials in the session. |
| 4 | + |
| 5 | +Base URL: dashboard origin (default `http://localhost:3000`). |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +### `GET /api/overview` |
| 10 | + |
| 11 | +Returns health, readiness, version, build, and summarized Prometheus metrics for the Overview page. |
| 12 | + |
| 13 | +## Databases |
| 14 | + |
| 15 | +### `GET /api/databases` |
| 16 | + |
| 17 | +Query params: `selected` (optional database name). |
| 18 | + |
| 19 | +Returns `{ "options": [ { "value", "label", "selected" } ] }` for database dropdowns. |
| 20 | + |
| 21 | +## Query Studio |
| 22 | + |
| 23 | +### `POST /api/query` |
| 24 | + |
| 25 | +Body (JSON or form): |
| 26 | + |
| 27 | +| Field | Description | |
| 28 | +|-------|-------------| |
| 29 | +| `q` | TimeseriesQL query | |
| 30 | +| `db` | Database name | |
| 31 | + |
| 32 | +Response: |
| 33 | + |
| 34 | +| Field | Description | |
| 35 | +|-------|-------------| |
| 36 | +| `error` | Error message when the query failed | |
| 37 | +| `durationMs` / `durationLabel` | Server-side execution time | |
| 38 | +| `rowCount` | Total rows across series | |
| 39 | +| `hasStats` | Whether timing stats are present | |
| 40 | +| `chartHint` | Hint when results are not time-series chartable | |
| 41 | +| `series[]` | Per-series columns, rows, and optional chart metadata | |
| 42 | + |
| 43 | +Series chart fields: `canChart`, `chartType` (`line` \| `bar`), `chartLines[]` with `label`, `points[]` (`x`, `y`), and optional `barLabels[]`. |
| 44 | + |
| 45 | +## Query History |
| 46 | + |
| 47 | +### `GET /api/queries/digests` |
| 48 | + |
| 49 | +List query digests with aggregate stats. |
| 50 | + |
| 51 | +### `GET /api/queries/digests/{digest}` |
| 52 | + |
| 53 | +Detail for one digest. |
| 54 | + |
| 55 | +### `GET /api/queries/stats` |
| 56 | + |
| 57 | +Summary statistics for charts. |
| 58 | + |
| 59 | +### `GET /api/queries/runs` |
| 60 | + |
| 61 | +Recent query runs timeline. |
| 62 | + |
| 63 | +### `DELETE /api/queries/digests` |
| 64 | + |
| 65 | +Reset in-memory digest history. |
| 66 | + |
| 67 | +## Data Explorer |
| 68 | + |
| 69 | +### `GET /api/explorer/tree` |
| 70 | + |
| 71 | +Lazy tree nodes. |
| 72 | + |
| 73 | +| Param | Description | |
| 74 | +|-------|-------------| |
| 75 | +| `level` | Tree level to expand | |
| 76 | +| `db` | Database | |
| 77 | +| `rp` | Retention policy | |
| 78 | +| `measurement` | Measurement | |
| 79 | +| `key` | Tag key (for value expansion) | |
| 80 | +| `q` | Search filter | |
| 81 | + |
| 82 | +Returns `{ "nodes": [ ... ] }`. |
| 83 | + |
| 84 | +### `GET /api/explorer/schema` |
| 85 | + |
| 86 | +Params: `db`, `rp`, `measurement`. Returns field and tag metadata. |
| 87 | + |
| 88 | +### `GET /api/explorer/data` |
| 89 | + |
| 90 | +Paginated measurement data. Params include `db`, `measurement`, `rp`, time range, tag filters, `page`, `page_size`, sort fields. |
| 91 | + |
| 92 | +### `GET /api/explorer/export` |
| 93 | + |
| 94 | +Same filters as data; returns CSV (row cap 1000). |
| 95 | + |
| 96 | +## Pages (HTML) |
| 97 | + |
| 98 | +| Route | Handler | |
| 99 | +|-------|---------| |
| 100 | +| `GET /` | Overview | |
| 101 | +| `GET /databases` | Databases | |
| 102 | +| `GET /query` | Query Studio | |
| 103 | +| `GET /queries` | Query History | |
| 104 | +| `GET /explorer` | Data Explorer | |
| 105 | +| `GET /storage` | Storage | |
| 106 | +| `GET /cluster` | Cluster (admin) | |
| 107 | +| `GET /admin/users` | Users (admin) | |
| 108 | +| `GET /admin/cqs` | Continuous queries (admin) | |
| 109 | +| `GET /login` | Login form | |
| 110 | +| `POST /login` | Authenticate | |
| 111 | +| `POST /logout` | End session | |
0 commit comments