API文档

接口规范与使用说明

简介

本文档描述了系统提供的API接口,包括接口地址、请求方法、参数说明和返回值格式等信息。

注意:所有API请求都需要在请求头中包含有效的认证信息。

用户相关接口

获取用户列表

GET
/api/users

请求参数

参数名 类型 必填 描述
page integer 页码,默认1
limit integer 每页数量,默认10

返回示例

{"code": 200, "data": { "total": 100, "list": [ {"id": 1, "name": "张三", "email": "zhangsan@example.com"}, {"id": 2, "name": "李四", "email": "lisi@example.com"} ] }, "message": "success" }

创建用户

POST
/api/users

请求参数

参数名 类型 必填 描述
name string 用户名
email string 邮箱地址
password string 密码

返回示例

{"code": 200, "data": { "id": 3, "name": "王五", "email": "wangwu@example.com" }, "message": "success" }

产品相关接口

获取产品详情

GET
/api/products/{id}

请求参数

参数名 类型 必填 描述
id integer 产品ID

返回示例

{"code": 200, "data": { "id": 1, "name": "产品名称", "price": 99.99, "description": "产品描述" }, "message": "success" }