发表评论
接口描述
发表一条评论
请求URI
/comment/item/:item_id
HTTP Method
POST
参数说明
参数名称 | 是否必填 | 参数说明 |
---|---|---|
item_id | true | 数据ID |
content | false | 评论内容, 支持@ , 格式为 <a href="###" hb_type="user" user_id="12345">@小明</a> |
parent_comment_id | false | 回复评论id |
file_ids | false | 附件文件数组 |
响应结果说明
名称 | 说明 |
---|---|
comment_id | 评论ID |
created_on | 创建时间 |
created_by | 评论用户对象,参考user 实例 |
content | 评论内容 |
files | 附件对象数组,参考file 实例 |
parent_comment | 回复评论对象,包含上述内容,不再有parent_comment |
请求示例
POST /v2/comment/item/:item_id HTTP/1.1
Host: api.huoban.com
Content-Type: application/json
Authorization: Bearer {YOUR ACCESS TOKEN}
{
"content": "下班一起去吃好吃的吧",
"parent_comment_id": 42141,
"file_ids": [
123123,
4214124
]
}
响应示例
HTTP/1.1 200 OK
Content-Type: application/json
{
"comment_id": 1927336,
"content": "下班一起去吃好吃的吧",
"parent_comment": {
"comment_id": 42141,
"content": "下班一起去吃好吃的吧",
"files": [],
"created_by": {
"user_id": 1000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"created_on": "2015-04-23 11:16:31"
},
"files": [
{
"file_id": 1000,
"name": "文件1",
"created_on": "enable",
"size": 2000,
"created_by": {
"user_id": 3000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"ref_id": 5000,
"ref_type": "item",
"link": {
"source": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"small": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"medium": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"large": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"square": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx"
}
}
],
"created_by": {
"user_id": 1000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"created_on": "2015-04-23 11:16:31"
}
删除评论
接口描述
删除指定评论
请求URI
/comment/:comment_id
HTTP Method
DELETE
参数说明
参数名称 | 是否必填 | 参数说明 |
---|---|---|
comment_id | true | 数据ID |
响应结果说明
名称 | 说明 |
---|
请求示例
DELETE /v2/comment/:comment_id HTTP/1.1
Host: api.huoban.com
Content-Type: application/json
Authorization: Bearer {YOUR ACCESS TOKEN}
响应示例
HTTP/1.1 200 OK
Content-Type: application/json
获取评论列表
接口描述
获取一条item的评论
请求URI
/comments/item/:item_id
HTTP Method
GET
参数说明
参数名称 | 是否必填 | 参数说明 |
---|---|---|
item_id | true | 数据ID |
offset | false | 结果返回的偏移量 |
limit | false | 结果返回的数量 |
响应结果说明
名称 | 说明 |
---|---|
comment对象数组 | comment对象参考comment 实例 |
请求示例
GET /v2/comments/item/:item_id?limit=10&offset=0 HTTP/1.1
Host: api.huoban.com
Content-Type: application/json
Authorization: Bearer {YOUR ACCESS TOKEN}
响应示例
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"comment_id": 1927336,
"content": "下班一起去吃好吃的吧",
"parent_comment": {
"comment_id": 42141,
"content": "下班一起去吃好吃的吧",
"files": [],
"created_by": {
"user_id": 1000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"created_on": "2015-04-23 11:16:31"
},
"files": [
{
"file_id": 1000,
"name": "文件1",
"created_on": "enable",
"size": 2000,
"created_by": {
"user_id": 3000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"ref_id": 5000,
"ref_type": "item",
"link": {
"source": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"small": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"medium": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"large": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx",
"square": "http:\/\/hb-v4-attachment-oss.huoban.com\/xxx"
}
}
],
"created_by": {
"user_id": 1000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"created_on": "2015-04-23 11:16:31"
},
{
"comment_id": 42141,
"content": "下班一起去吃好吃的吧",
"parent_comment": [],
"files": [],
"created_by": {
"user_id": 1000,
"name": "名字",
"avatar": "http:\/\/f2.huoban.com\/30000\/user_avatar\/40000\/xxx"
},
"created_on": "2015-04-23 11:16:31"
}
]