2024-05-23 23:18:52 +08:00
|
|
|
|
# RESTFul API 文档
|
|
|
|
|
|
|
|
|
|
## 分页获取post接口
|
|
|
|
|
|
|
|
|
|
### 1 接口描述
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 2 请求URL
|
|
|
|
|
`/v1/posts?type=&style=&page=&page_size=`
|
|
|
|
|
|
|
|
|
|
### 3 请求方式
|
|
|
|
|
**GET**
|
|
|
|
|
|
|
|
|
|
### 4 请求头
|
|
|
|
|
| 头字段 | 必填 | 数据类型 | 描述 |
|
|
|
|
|
| ------------ | ---- | ------------- | -------------------------------- |
|
|
|
|
|
| | | ||
|
|
|
|
|
|
|
|
|
|
### 5 Query参数
|
|
|
|
|
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 | 示例 | 允许空值 |
|
|
|
|
|
|--------|----| -------- | ------- |----|------------|------|
|
|
|
|
|
| style | 是 | 字符串 | | 类型 | "newest" | 否 |
|
|
|
|
|
|
|
|
|
|
### 6 请求示例
|
|
|
|
|
```http
|
|
|
|
|
GET /v1/posts?type=1716477250320&style=newest&page=1&page_size=20
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 7 返回参数说明
|
2024-05-28 08:10:37 +08:00
|
|
|
|
| 参数名称 | 必填 | 数据类型 | 约束条件 | 描述 |
|
|
|
|
|
|------| ---- | -------- | -------- |-----------|
|
|
|
|
|
| code | 是 | 整型 | | 错误码,0表示成功 |
|
|
|
|
|
| msg | 否 | 字符串 | 1-50字符 | 错误信息描述 |
|
|
|
|
|
| data | 否 | json | | 具体业务数据 |
|
2024-05-23 23:18:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 8 响应示例(成功)
|
|
|
|
|
```json
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"code": 0,
|
|
|
|
|
"msg": "success",
|
|
|
|
|
"data": {
|
|
|
|
|
"list": [
|
|
|
|
|
{
|
|
|
|
|
"id": 1080017993,
|
|
|
|
|
"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": 180022551,
|
|
|
|
|
"post_id": 1080017993,
|
|
|
|
|
"content": "@whz look at .",
|
|
|
|
|
"type": 2,
|
|
|
|
|
"sort": 100
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 180022552,
|
|
|
|
|
"post_id": 1080017993,
|
|
|
|
|
"content": "http://60.204.241.255:8008/oss/paopao/public/image/4f/27/bd/d8/91f3-4d6f-bb5a-5705fc65c996.jpeg",
|
|
|
|
|
"type": 3,
|
|
|
|
|
"sort": 101
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"comment_count": 5,
|
|
|
|
|
"collection_count": 1,
|
|
|
|
|
"share_count": 0,
|
|
|
|
|
"upvote_count": 1,
|
|
|
|
|
"visibility": 0,
|
|
|
|
|
"is_top": 0,
|
|
|
|
|
"is_essence": 1,
|
|
|
|
|
"is_lock": 0,
|
|
|
|
|
"latest_replied_on": 1716273899,
|
|
|
|
|
"created_on": 1714292225,
|
|
|
|
|
"modified_on": 1714292225,
|
|
|
|
|
"tags": {
|
|
|
|
|
"": 1
|
|
|
|
|
},
|
|
|
|
|
"attachment_price": 0,
|
|
|
|
|
"ip_loc": "山东省临沂市"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 1080017991,
|
|
|
|
|
"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": 180022548,
|
|
|
|
|
"post_id": 1080017991,
|
|
|
|
|
"content": "#PAOPAO #J2EE hello world",
|
|
|
|
|
"type": 2,
|
|
|
|
|
"sort": 100
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"comment_count": 1,
|
|
|
|
|
"collection_count": 1,
|
|
|
|
|
"share_count": 0,
|
|
|
|
|
"upvote_count": 0,
|
|
|
|
|
"visibility": 0,
|
|
|
|
|
"is_top": 0,
|
|
|
|
|
"is_essence": 1,
|
|
|
|
|
"is_lock": 0,
|
|
|
|
|
"latest_replied_on": 1714291719,
|
|
|
|
|
"created_on": 1714291046,
|
|
|
|
|
"modified_on": 1714291046,
|
|
|
|
|
"tags": {
|
|
|
|
|
"J2EE": 1,
|
|
|
|
|
"PAOPAO": 1
|
|
|
|
|
},
|
|
|
|
|
"attachment_price": 0,
|
|
|
|
|
"ip_loc": "山东省临沂市"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 1080017989,
|
|
|
|
|
"user_id": 100058,
|
|
|
|
|
"user": {
|
|
|
|
|
"id": 100058,
|
|
|
|
|
"nickname": "whz",
|
|
|
|
|
"username": "whz",
|
|
|
|
|
"status": 1,
|
|
|
|
|
"avatar": "https://assets.paopao.info/public/avatar/default/mike.png",
|
|
|
|
|
"is_admin": false,
|
|
|
|
|
"is_friend": false,
|
|
|
|
|
"is_following": false
|
|
|
|
|
},
|
|
|
|
|
"contents": [
|
|
|
|
|
{
|
|
|
|
|
"id": 180022546,
|
|
|
|
|
"post_id": 1080017989,
|
|
|
|
|
"content": "#PAOPAO 测试",
|
|
|
|
|
"type": 2,
|
|
|
|
|
"sort": 100
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"comment_count": 0,
|
|
|
|
|
"collection_count": 1,
|
|
|
|
|
"share_count": 0,
|
|
|
|
|
"upvote_count": 1,
|
|
|
|
|
"visibility": 0,
|
|
|
|
|
"is_top": 0,
|
|
|
|
|
"is_essence": 1,
|
|
|
|
|
"is_lock": 1,
|
|
|
|
|
"latest_replied_on": 1713353666,
|
|
|
|
|
"created_on": 1713353666,
|
|
|
|
|
"modified_on": 1713353666,
|
|
|
|
|
"tags": {
|
|
|
|
|
"PAOPAO": 1
|
|
|
|
|
},
|
|
|
|
|
"attachment_price": 0,
|
|
|
|
|
"ip_loc": "山东省聊城市"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"pager": {
|
|
|
|
|
"page": 1,
|
|
|
|
|
"page_size": 20,
|
|
|
|
|
"total_rows": 3
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 9 响应示例(错误)
|
|
|
|
|
```json
|
2024-05-28 14:58:50 +08:00
|
|
|
|
{ "code": 10001, "msg": "验证码无效" }
|
2024-05-23 23:18:52 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 10 错误响应码参考
|
|
|
|
|
更多响应错误码及含义,请参阅[API响应码表](URL/for/api/responseCode/table)。
|
|
|
|
|
|
|
|
|
|
### 11 安全性与认证
|
|
|
|
|
此API要求调用方在`Authorization`头中携带经过Bearer认证的令牌。
|
|
|
|
|
|
|
|
|
|
### 12 测试环境
|
|
|
|
|
访问测试环境以进行接口调试:
|
|
|
|
|
[https://test.apiAddress.com](https://test.apiAddress.com)
|
|
|
|
|
|
|
|
|
|
### 13 版本管理
|
|
|
|
|
本API通过URI路径进行版本控制。请在请求URL中包含`/v1`以使用当前版本。
|
|
|
|
|
|
|
|
|
|
### 14 更新记录
|
|
|
|
|
- **2024-04-22**:发布文档初始版本。
|
|
|
|
|
- **2024-05-05**:新增安全性说明和测试环境链接。
|
|
|
|
|
|
|
|
|
|
### 15 联系支持
|
|
|
|
|
如需帮助或对API有任何疑问,请通过电子邮件与我们联系:[support@api.com](mailto:support@api.com)。
|
|
|
|
|
|
|
|
|
|
### 16 反馈与建议
|
|
|
|
|
发现文档问题或有改进建议?请填写[反馈表单](https://forms.api.com/feedback)与我们分享。
|
|
|
|
|
|