116 lines
2.4 KiB
HTTP
116 lines
2.4 KiB
HTTP
# Photography Backend API 测试文件
|
|
|
|
### 健康检查
|
|
GET http://localhost:8080/health
|
|
|
|
### 获取数据库统计
|
|
GET http://localhost:8080/stats
|
|
|
|
### 用户注册
|
|
POST http://localhost:8080/api/v1/auth/register
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"username": "testuser",
|
|
"email": "test@example.com",
|
|
"password": "password123",
|
|
"name": "测试用户"
|
|
}
|
|
|
|
### 用户登录
|
|
POST http://localhost:8080/api/v1/auth/login
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"username": "testuser",
|
|
"password": "password123"
|
|
}
|
|
|
|
### 获取所有用户
|
|
GET http://localhost:8080/api/v1/users
|
|
|
|
### 创建用户
|
|
POST http://localhost:8080/api/v1/users
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"username": "newuser",
|
|
"email": "newuser@example.com",
|
|
"password": "password123",
|
|
"name": "新用户",
|
|
"role": "user"
|
|
}
|
|
|
|
### 获取所有分类
|
|
GET http://localhost:8080/api/v1/categories
|
|
|
|
### 创建分类
|
|
POST http://localhost:8080/api/v1/categories
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "风景摄影",
|
|
"description": "自然风光摄影作品",
|
|
"user_id": 1,
|
|
"color": "#10B981"
|
|
}
|
|
|
|
### 获取所有标签
|
|
GET http://localhost:8080/api/v1/tags
|
|
|
|
### 创建标签
|
|
POST http://localhost:8080/api/v1/tags
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"name": "自然",
|
|
"description": "自然风光主题",
|
|
"user_id": 1,
|
|
"color": "#10B981"
|
|
}
|
|
|
|
### 获取所有相册
|
|
GET http://localhost:8080/api/v1/albums
|
|
|
|
### 创建相册
|
|
POST http://localhost:8080/api/v1/albums
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"title": "我的摄影作品",
|
|
"description": "个人摄影作品集",
|
|
"user_id": 1,
|
|
"is_public": true
|
|
}
|
|
|
|
### 获取所有照片
|
|
GET http://localhost:8080/api/v1/photos
|
|
|
|
### 创建照片记录
|
|
POST http://localhost:8080/api/v1/photos
|
|
Content-Type: application/json
|
|
|
|
{
|
|
"title": "美丽风景",
|
|
"description": "在山顶拍摄的日出",
|
|
"filename": "sunrise.jpg",
|
|
"original_url": "http://localhost:8080/uploads/photos/sunrise.jpg",
|
|
"file_size": 1024000,
|
|
"mime_type": "image/jpeg",
|
|
"user_id": 1,
|
|
"category_id": 1
|
|
}
|
|
|
|
### 文件上传 (需要使用支持文件上传的客户端)
|
|
# POST http://localhost:8080/api/v1/upload/photo
|
|
# Content-Type: multipart/form-data
|
|
# Authorization: Bearer YOUR_JWT_TOKEN
|
|
#
|
|
# photo: [选择图片文件]
|
|
# title: 照片标题
|
|
# description: 照片描述
|
|
# category_id: 1
|
|
|
|
### 获取上传统计 (需要管理员权限)
|
|
# GET http://localhost:8080/api/v1/upload/stats
|
|
# Authorization: Bearer ADMIN_JWT_TOKEN |