mirror of
https://gitee.com/many2many/java-web.git
synced 2025-01-11 14:40:55 +08:00
add api doc
This commit is contained in:
parent
cb22bc912f
commit
64e6943c2d
@ -285,6 +285,10 @@ AuthService类中添加登录方法,实现用户登录功能。
|
||||
|
||||
#### 7.3.1 API
|
||||
|
||||
[发布动态接口](./resources/发布动态接口.md)
|
||||
|
||||
[附件上传接口](./resources/附件上传接口.md)
|
||||
|
||||
#### 7.3.2 实体类和Repository接口
|
||||
|
||||
#### 7.3.3 Controller和service
|
||||
|
201
docs/resources/发布动态接口.md
Normal file
201
docs/resources/发布动态接口.md
Normal file
@ -0,0 +1,201 @@
|
||||
## 1. 发布动态接口
|
||||
|
||||
### 1.1 接口描述
|
||||
用户发布动态。 动态支持图片、文字、话题、@等功能。
|
||||
### 1.2 请求URL
|
||||
`/v1/post`
|
||||
|
||||
### 1.3 请求方式
|
||||
**POST**
|
||||
|
||||
### 1.4 请求头
|
||||
| 头字段 | 必填 | 数据类型 | 描述 |
|
||||
| ------------ | ---- | ------------- | -------------------------------- |
|
||||
| Content-Type | 是 | application/json | 指定请求体的媒体类型为JSON |
|
||||
|
||||
### 1.5 请求体参数
|
||||
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 | 示例 | 允许空值 |
|
||||
|-----------| ---- | -------- |--------| ---------------------------- | ----------- | -------- |
|
||||
| | | | | | | |
|
||||
| | | | | | | |
|
||||
|
||||
|
||||
### 1.6 请求示例
|
||||
```http
|
||||
POST /v1/auth/login
|
||||
Host: {apiAddress}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"content": "@ddd @mike #PAOPAO #J2EE #travel nice !!",
|
||||
"type": 2,
|
||||
"sort": 100
|
||||
},
|
||||
{
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/public/image/a2/6c/98/b8/17f2-4508-b7ed-57be788958ee.jpeg",
|
||||
"type": 3,
|
||||
"sort": 101
|
||||
},
|
||||
{
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/public/image/e6/58/3f/52/6d00-48de-ad48-1010a6e602ce.jpeg",
|
||||
"type": 3,
|
||||
"sort": 102
|
||||
},
|
||||
{
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/attachment/6a/e0/ee/73/6ec8-457a-b889-dc524c3c7f22.zip",
|
||||
"type": 7,
|
||||
"sort": 103
|
||||
},
|
||||
{
|
||||
"content": "http://baidu.com",
|
||||
"type": 6,
|
||||
"sort": 104
|
||||
},
|
||||
{
|
||||
"content": "http://taobao.com",
|
||||
"type": 6,
|
||||
"sort": 105
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"PAOPAO",
|
||||
"J2EE",
|
||||
"travel"
|
||||
],
|
||||
"users": [
|
||||
"ddd",
|
||||
"mike"
|
||||
],
|
||||
"attachment_price": 800,
|
||||
"visibility": 2
|
||||
}
|
||||
```
|
||||
|
||||
### 1.7 返回参数说明
|
||||
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 |
|
||||
|------| ---- | -------- | -- |-----------|
|
||||
| code | 是 | 整型 | | 错误码,0表示成功 |
|
||||
| msg | 否 | 字符串 | | 错误信息描述 |
|
||||
| data | 否 | json | | 具体业务数据 |
|
||||
|
||||
|
||||
data结构说明:
|
||||
|
||||
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 |
|
||||
|-------| ---- | -------- |------|-----------|
|
||||
| | | | | |
|
||||
|
||||
### 1.8 响应示例(成功)
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "success",
|
||||
"data": {
|
||||
"id": 1080017998,
|
||||
"user_id": 100066,
|
||||
"user": {
|
||||
"id": 100066,
|
||||
"nickname": "xyz",
|
||||
"username": "xyz",
|
||||
"status": 1,
|
||||
"avatar": "https://assets.paopao.info/public/avatar/default/jackson.png",
|
||||
"is_admin": false,
|
||||
"is_friend": false,
|
||||
"is_following": false
|
||||
},
|
||||
"contents": [
|
||||
{
|
||||
"id": 180022562,
|
||||
"post_id": 1080017998,
|
||||
"content": "@ddd @mike #PAOPAO #J2EE #travel nice !!",
|
||||
"type": 2,
|
||||
"sort": 100
|
||||
},
|
||||
{
|
||||
"id": 180022563,
|
||||
"post_id": 1080017998,
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/public/image/a2/6c/98/b8/17f2-4508-b7ed-57be788958ee.jpeg",
|
||||
"type": 3,
|
||||
"sort": 101
|
||||
},
|
||||
{
|
||||
"id": 180022564,
|
||||
"post_id": 1080017998,
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/public/image/e6/58/3f/52/6d00-48de-ad48-1010a6e602ce.jpeg",
|
||||
"type": 3,
|
||||
"sort": 102
|
||||
},
|
||||
{
|
||||
"id": 180022565,
|
||||
"post_id": 1080017998,
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/attachment/6a/e0/ee/73/6ec8-457a-b889-dc524c3c7f22.zip",
|
||||
"type": 8,
|
||||
"sort": 103
|
||||
},
|
||||
{
|
||||
"id": 180022566,
|
||||
"post_id": 1080017998,
|
||||
"content": "http://baidu.com",
|
||||
"type": 6,
|
||||
"sort": 104
|
||||
},
|
||||
{
|
||||
"id": 180022567,
|
||||
"post_id": 1080017998,
|
||||
"content": "http://taobao.com",
|
||||
"type": 6,
|
||||
"sort": 105
|
||||
}
|
||||
],
|
||||
"comment_count": 0,
|
||||
"collection_count": 0,
|
||||
"share_count": 0,
|
||||
"upvote_count": 0,
|
||||
"visibility": 50,
|
||||
"is_top": 0,
|
||||
"is_essence": 0,
|
||||
"is_lock": 0,
|
||||
"latest_replied_on": 1715913367,
|
||||
"created_on": 1715913367,
|
||||
"modified_on": 1715913367,
|
||||
"tags": {
|
||||
"J2EE": 1,
|
||||
"PAOPAO": 1,
|
||||
"travel": 1
|
||||
},
|
||||
"attachment_price": 800,
|
||||
"ip_loc": "山东省临沂市"
|
||||
}
|
||||
}
|
||||
```
|
||||
### 1.9 响应示例(错误)
|
||||
```json
|
||||
{ "code": 401, "msg": "验证失败" }
|
||||
```
|
||||
|
||||
### 1.10 错误响应码参考
|
||||
更多响应错误码及含义,请参阅[API响应码表](URL/for/api/responseCode/table)。
|
||||
|
||||
### 1.11 安全性与认证
|
||||
|
||||
|
||||
### 1.12 测试环境
|
||||
访问测试环境以进行接口调试:
|
||||
[https://test.apiAddress.com](https://test.apiAddress.com)
|
||||
|
||||
### 1.13 版本管理
|
||||
本API通过URI路径进行版本控制。请在请求URL中包含`/v1`以使用当前版本。
|
||||
|
||||
### 1.14 更新记录
|
||||
- **2024-04-29**:发布文档初始版本。
|
||||
|
||||
|
||||
### 1.15 联系支持
|
||||
如需帮助或对API有任何疑问,请通过电子邮件与我们联系:[support@api.com](mailto:support@api.com)。
|
||||
|
||||
### 1.16 反馈与建议
|
||||
发现文档问题或有改进建议?请填写[反馈表单](https://forms.api.com/feedback)与我们分享。
|
||||
|
99
docs/resources/附件上传接口.md
Normal file
99
docs/resources/附件上传接口.md
Normal file
@ -0,0 +1,99 @@
|
||||
## 1. 附件上传
|
||||
|
||||
### 1.1 接口描述
|
||||
上传图片、视频、压缩文件等。
|
||||
### 1.2 请求URL
|
||||
`/v1/post`
|
||||
|
||||
### 1.3 请求方式
|
||||
**POST**
|
||||
|
||||
multipart/form-data方式上传文件
|
||||
|
||||
### 1.4 请求头示例
|
||||
```http
|
||||
Content-Type: multipart/form-data; boundary=----12256474795412178794287418104
|
||||
```
|
||||
|
||||
### 1.6 请求体示例
|
||||
```http
|
||||
-----------------------------12256474795412178794287418104
|
||||
Content-Disposition: form-data; name="type"
|
||||
|
||||
public/image
|
||||
-----------------------------12256474795412178794287418104
|
||||
Content-Disposition: form-data; name="file"; filename="2024-03-18_22-06.png"
|
||||
Content-Type: image/png
|
||||
这里是文件内容...
|
||||
-----------------------------12256474795412178794287418104
|
||||
|
||||
```
|
||||
```http
|
||||
-----------------------------35576727471291609851653063070
|
||||
Content-Disposition: form-data; name="type"
|
||||
attachment
|
||||
-----------------------------35576727471291609851653063070
|
||||
Content-Disposition: form-data; name="file"; filename="paopao.zip"
|
||||
Content-Type: application/zip
|
||||
这里是文件内容...
|
||||
-----------------------------35576727471291609851653063070
|
||||
```
|
||||
|
||||
### 1.7 返回参数说明
|
||||
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 |
|
||||
|------| ---- | -------- | -- |-----------|
|
||||
| code | 是 | 整型 | | 错误码,0表示成功 |
|
||||
| msg | 否 | 字符串 | | 错误信息描述 |
|
||||
| data | 否 | json | | 具体业务数据 |
|
||||
|
||||
|
||||
data结构说明:
|
||||
|
||||
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 |
|
||||
|-------| ---- | -------- |------|-----------|
|
||||
| | | | | |
|
||||
|
||||
### 1.8 响应示例(成功)
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "success",
|
||||
"data": {
|
||||
"user_id": 100066,
|
||||
"file_size": 249763,
|
||||
"img_width": 0,
|
||||
"img_height": 0,
|
||||
"type": 1,
|
||||
"content": "http://60.204.241.255:8008/oss/paopao/public/image/4f/77/ec/5f/85ad-4189-887d-785cac178e21.png"
|
||||
}
|
||||
}
|
||||
```
|
||||
### 1.9 响应示例(错误)
|
||||
```json
|
||||
{ "code": 500, "msg": "失败" }
|
||||
```
|
||||
|
||||
### 1.10 错误响应码参考
|
||||
更多响应错误码及含义,请参阅[API响应码表](URL/for/api/responseCode/table)。
|
||||
|
||||
### 1.11 安全性与认证
|
||||
|
||||
|
||||
### 1.12 测试环境
|
||||
访问测试环境以进行接口调试:
|
||||
[https://test.apiAddress.com](https://test.apiAddress.com)
|
||||
|
||||
### 1.13 版本管理
|
||||
本API通过URI路径进行版本控制。请在请求URL中包含`/v1`以使用当前版本。
|
||||
|
||||
### 1.14 更新记录
|
||||
- **2024-04-29**:发布文档初始版本。
|
||||
|
||||
|
||||
### 1.15 联系支持
|
||||
如需帮助或对API有任何疑问,请通过电子邮件与我们联系:[support@api.com](mailto:support@api.com)。
|
||||
|
||||
### 1.16 反馈与建议
|
||||
发现文档问题或有改进建议?请填写[反馈表单](https://forms.api.com/feedback)与我们分享。
|
||||
|
Loading…
Reference in New Issue
Block a user