java-web/docs/resources/发布动态接口.md
2024-12-02 08:00:52 +08:00

202 lines
5.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 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)与我们分享。