API 参考

核心接口

业务功能核心接口文档

核心接口

用户管理

GET /api/users

获取用户列表。

查询参数

参数 类型 说明
page integer 页码,默认1
per_page integer 每页数量,默认20
keyword string 搜索关键词

响应示例

{
  "code": 200,
  "data": {
    "items": [
      {
        "id": 1,
        "username": "admin",
        "email": "admin@example.com",
        "created_at": "2024-01-15T08:30:00Z"
      }
    ],
    "total": 100,
    "page": 1,
    "per_page": 20
  }
}

内容管理

POST /api/content

创建新内容。

请求体

{
  "title": "文章标题",
  "content": "文章内容",
  "category": "技术",
  "tags": ["hugo", "教程"]
}

PUT /api/content/{id}

更新指定内容。

DELETE /api/content/{id}

删除指定内容。

错误码

错误码 说明
400 请求参数错误
401 未授权
403 权限不足
404 资源不存在
500 服务器内部错误

Comments

0%