37 lines
809 B
Markdown
37 lines
809 B
Markdown
# API Response Convention
|
||
|
||
统一响应格式(JSON 接口):
|
||
|
||
- 成功:
|
||
```json
|
||
{
|
||
"code": "OK",
|
||
"message": "ok|success|...",
|
||
"data": { }
|
||
}
|
||
```
|
||
|
||
- 失败:
|
||
```json
|
||
{
|
||
"code": "ERR_...",
|
||
"message": "..."
|
||
}
|
||
```
|
||
|
||
## 约定
|
||
|
||
1. 所有 `/api/v1/*` JSON 接口使用统一结构。
|
||
2. 文件流接口(如 CSV 导出)成功时返回文件内容;失败时返回统一错误 JSON。
|
||
3. 权限失败统一 `ERR_PERMISSION_DENIED`。
|
||
4. 执行失败统一至少返回一个业务错误码(例如 `ERR_STEP_FAILED`)。
|
||
5. `message` 用于人类可读,`code` 用于前端逻辑分支。
|
||
|
||
## 已接入范围(2026-03-10)
|
||
|
||
- Ops: jobs/list/detail/cancel/retry
|
||
- Flags: list/patch
|
||
- Channels: list/patch/publish/reload/enable/disable/disable-all/test/apply
|
||
- Records: list/delete
|
||
- Audit: list
|