EduCovers
EduCovers
文档博客文档
API 参考
API 参考

API 参考

完整的 API 文档和参考

API 参考

本节提供所有可用 API 的完整文档。

身份验证

所有 API 端点都需要使用 Bearer 令牌进行身份验证。

const response = await fetch('/api/endpoint', {
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
});

端点

GET /api/users

获取用户列表。

响应

{
  "data": [
    {
      "id": "1",
      "name": "John Doe",
      "email": "john@example.com"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 100
  }
}

POST /api/users

创建新用户。

请求体

{
  "name": "Jane Doe",
  "email": "jane@example.com"
}

响应

{
  "id": "2",
  "name": "Jane Doe",
  "email": "jane@example.com",
  "createdAt": "2024-01-01T00:00:00Z"
}

错误处理

所有 API 错误遵循一致的格式:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "无效的请求参数",
    "details": []
  }
}

速率限制

API 请求限制为每用户每分钟 100 次请求。

快速开始

了解如何设置和使用文档应用

案例展示

查看 Python 教程和备考视频的封面文案创意示例。

On this page

API 参考身份验证端点GET /api/usersPOST /api/users错误处理速率限制