API 参考文档
本文档提供了平台所有 API 接口的详细说明。
本文档提供了平台所有 API 接口的详细说明。
本文档提供了平台所有 API 接口的详细说明。
本文档提供了平台所有 API 接口的详细说明。
认证 API
用户登录
POST /api/auth/login
请求体:
{
"email": "user@example.com",
"password": "password123"
}
响应:
{
"token": "jwt-token",
"user": {
"id": "123",
"email": "user@example.com",
"name": "用户名"
}
}
用户注册
POST /api/auth/register
请求体:
{
"email": "user@example.com",
"password": "password123",
"name": "用户名"
}
用户 API
获取用户信息
GET /api/users/:id
响应:
{
"id": "123",
"email": "user@example.com",
"name": "用户名",
"createdAt": "2024-11-10T00:00:00Z"
}
更新用户信息
PUT /api/users/:id
请求体:
{
"name": "新用户名",
"avatar": "https://example.com/avatar.jpg"
}
文档 API
获取文档列表
GET /api/docs
查询参数:
locale: 语言代码 (en, zh, ja)category: 分类limit: 每页数量offset: 偏移量
获取文档详情
GET /api/docs/:slug
错误码
| 错误码 | 说明 |
|---|---|
| 400 | 请求参数错误 |
| 401 | 未授权 |
| 403 | 禁止访问 |
| 404 | 资源不存在 |
| 500 | 服务器错误 |
速率限制
API 限制:
- 认证用户:100 请求/分钟
- 未认证用户:10 请求/分钟