更新 API.md
This commit is contained in:
parent
b2fea7a26e
commit
635c033047
46
API.md
46
API.md
@ -6,8 +6,8 @@
|
||||
|
||||
## 认证方式
|
||||
使用简单的 Token 认证(实际生产环境应使用 JWT 等更安全的方式)。
|
||||
登录后返回的 Token 需在后续请求中通过 `Authorization` 头携带:
|
||||
`Authorization: Bearer <your_token>`
|
||||
登录后返回的 Token 需在后续请求中通过 `Authorization` 头携带: `Authorization: Bearer <your_token>`
|
||||
|
||||
|
||||
---
|
||||
|
||||
@ -19,23 +19,23 @@
|
||||
**请求体**:
|
||||
```json
|
||||
{
|
||||
"username": "string",
|
||||
"password": "string"
|
||||
"username": "string",
|
||||
"password": "string"
|
||||
}
|
||||
```
|
||||
|
||||
**成功响应**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "User registered successfully"
|
||||
"success": true,
|
||||
"message": "User registered successfully"
|
||||
}
|
||||
```
|
||||
**错误响应**:
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "Username already exists"
|
||||
"success": false,
|
||||
"message": "Username already exists"
|
||||
}
|
||||
```
|
||||
|
||||
@ -48,26 +48,26 @@
|
||||
**请求体**:
|
||||
```json
|
||||
{
|
||||
"username": "string",
|
||||
"password": "string"
|
||||
"username": "string",
|
||||
"password": "string"
|
||||
}
|
||||
```
|
||||
|
||||
**成功响应**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Login successful",
|
||||
"token": "string",
|
||||
"user_id": "integer",
|
||||
"username": "string"
|
||||
"success": true,
|
||||
"message": "Login successful",
|
||||
"token": "string",
|
||||
"user_id": "integer",
|
||||
"username": "string"
|
||||
}
|
||||
```
|
||||
**错误响应**:
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "Invalid username or password"
|
||||
"success": false,
|
||||
"message": "Invalid username or password"
|
||||
}
|
||||
```
|
||||
|
||||
@ -130,23 +130,23 @@
|
||||
**请求体**:
|
||||
```json
|
||||
{
|
||||
"message_id": "integer",
|
||||
"user_id": "integer"
|
||||
"message_id": "integer",
|
||||
"user_id": "integer"
|
||||
}
|
||||
```
|
||||
|
||||
**成功响应**:
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Message recalled successfully"
|
||||
"success": true,
|
||||
"message": "Message recalled successfully"
|
||||
}
|
||||
```
|
||||
**错误响应**:
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"message": "You can only recall your own messages"
|
||||
"success": false,
|
||||
"message": "You can only recall your own messages"
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user