API 参考文档

发表于 2025-02-06 00:00 208 字 2 min read

猪京京 avatar

猪京京

猪京京的数字花园,记录学习、思考和探索的空间

项目 API 接口参考文档

API 参考文档

概述

本文档提供了项目所有 API 接口的详细说明。

用户相关

获取用户信息

GET /api/user/{userId}

参数:

  • userId (路径参数): 用户 ID

响应:

{
  "id": "123",
  "name": "张三",
  "email": "zhangsan@example.com"
}

更新用户信息

PUT /api/user/{userId}
Content-Type: application/json

请求体:

{
  "name": "李四",
  "email": "lisi@example.com"
}

文章相关

获取文章列表

GET /api/posts?page=1&limit=10

参数:

  • page (查询参数): 页码,默认 1
  • limit (查询参数): 每页数量,默认 10

获取文章详情

GET /api/post/{slug}

参数:

  • slug (路径参数): 文章 slug

错误码

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

版本历史

  • v1.0.0 (2025-02-06): 初始版本
© 2025 - 2026 猪京京 @pigthinktank
Powered by theme astro-koharu · Inspired by Shoka