活动接口文档 -- 获取活动里的帖子或单个帖子
好热闹
活动
获取活动的帖子列表
只有加入活动的用户才能看到回帖
接口有 5 分钟的缓存
Method and URL Structure
Method |
Resource URL |
NOTE |
GET |
/activity/${page}/${activity_id}/topics |
每页10条 |
Request Parameters
Name |
Description |
Required |
Default |
username |
用户名 |
YES |
|
password |
密码 |
YES |
|
topic_type |
帖子类型 |
YES |
|
Topic Type List
Name |
Description |
Display |
teaching |
教学贴 |
教学 |
qa |
问答贴 |
问答 |
Request
{
"username":"18512345678",
"password":"123456",
"topic_type":"qa",
}
cURL Example
# ID 为 1945 的活动里问答类型的帖子,第 2 页。
$ curl http://www.haorenao.cn/activity/2/1945/topics/?topic_type=qa&username=18012345678&password=123456
JSON Response
Name |
Description |
NOTE |
ret |
标识是否成功。 |
@Depracted |
reason |
失败原因 |
@Depracted |
status |
Status Code |
|
message |
Failure Message |
|
topics |
帖子列表 |
Topic |
posts |
返回前三个回帖 |
|
{
"ret":"ok", # ok, 成功; failed, 失败
"reason":"",
"status":0,
"message":"",
"topics": [{
"username": "12345678",
"nickname": "\u5c0f\u4e8c",
"id": 4,
"title": "Online Activity Testing 001",
"content": "You need a fully-functional OAuth2 provider.."
"create_time": "2016-04-01 11:39:58",
"last_replied": "2016-04-01 11:39:58",
"click":4,
"reply_count":2,
"topic_type":"qa",
"pictures":["resource.haorenao.cn/pic1.jpg",],
"videos":["resource.haorenao.cn/video1.mp4",],
"topic_type_display":"问答",
"posts": [{
"id": 1,
"nickname": "13543296793",
"username": "13543296793",
"content": "What you need to...",
}..]
}...]
}
获取单个帖子
只有加入活动的用户才能看到回帖
接口有 5 分钟的缓存
Method and URL Structure
Method |
Resource URL |
GET |
/activity/${id}/topic |
Request Parameters
Name |
Description |
Required |
Default |
username |
用户名 |
YES |
|
password |
密码 |
YES |
|
cURL Example
# ID 为 1898 的帖子
$ curl http://www.haorenao.cn/activity/1898/topic/?username=18012345678&password=123456
JSON Response
Name |
Description |
NOTE |
ret |
标识是否成功。 |
@Depracted |
reason |
失败原因 |
@Depracted |
status |
Status Code |
|
message |
Failure Message |
|
topic |
帖子 |
|
Topic
Name |
Description |
NOTE |
username |
创建者用户名 |
|
nickname |
创建者昵称 |
|
id |
topic ID |
|
title |
主题 |
|
content |
内容 |
|
create_time |
创建时间 |
|
last_replied |
最进回复时间 |
|
click |
点击次数 |
|
reply_count |
回复数 |
|
topic_type |
帖子类型 |
Type List |
topic_type_diplay |
type 的中文显示 |
|
{
"ret":"ok", # ok, 成功; failed, 失败
"reason":"",
"status":0,
"message":"",
"topic": {
"username": "12345678",
"nickname": "\u5c0f\u4e8c",
"id": 1898,
"title": "Online Activity Testing 001",
"content": "You need a fully-functional OAuth2 provider.."
"create_time": "2016-04-01 11:39:58",
"last_replied": "2016-04-01 11:39:58",
"pictures":["resource.haorenao.cn/pic1.jpg",],
"videos":["resource.haorenao.cn/video1.mp4",],
"click":4,
"reply_count":2,
"topic_type":"qa",
"topic_type_display":"问答",
}
}