错误码与分页约定
列表和详情接口通用的响应格式。
状态码
- 200 — 成功。
- 201 — 预留给未来的创建场景(当前未使用)。
- 400 — 请求不合法(缺失字段、查询值错误)。格式:
{ error: string, issues?: zodIssue[] }。 - 401 — Bearer Token 缺失或无效。
- 404 — 资源不存在或不属于当前工作区。
- 422 — Posts 相关的校验失败,返回 Zod 的
issues。 - 429 — 触发限流;遵循
Retry-After头再重试。 - 500 — 服务器异常。
issues 使用 Zod 结构(path、message、code)。
分页
所有列表接口(/media、/posts、/social-accounts、/post-results)使用
基于 offset 的分页。
查询参数
offset— 数字,默认0,必须 ≥ 0。limit— 数字,默认10,最大100。
响应封装
{
"data": [/* items */],
"meta": {
"offset": 0,
"limit": 10,
"total": 123
}
}total 表示在当前工作区与过滤条件下的总记录数。
