mengstack-website/api/system.md
2026-10-02 23:55:36 +08:00

67 lines
956 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 系统接口
## 健康检查
检查 PostgreSQL 和 Redis 连接状态。
**`GET /health`**
无需认证。
### 响应
```json
{
"status": "ok",
"database": "connected",
"redis": "connected",
"timestamp": 1727856000,
"version": "0.1.0",
"trace_id": "req-abc-123"
}
```
### 状态说明
| 字段 | 可能值 |
|------|--------|
| `status` | `ok` / `degraded` / `down` |
| `database` | `connected` / `disconnected` |
| `redis` | `connected` / `disconnected` |
---
## 连通性测试
返回 pong,用于验证认证和多租户中间件是否正常工作。
**`GET /api/v1/ping`**
需要认证和租户头。
### 请求头
```
Authorization: Bearer <access_token>
X-Tenant-ID: <tenant_id>
```
### 响应
```json
{
"code": 0,
"message": "success",
"data": {
"message": "pong"
},
"trace_id": "req-abc-123"
}
```
### 用途
- 验证 Token 是否有效
- 验证多租户中间件是否正常
- 客户端心跳检测