[关闭]
@fuyb1986 2016-04-21T07:24:32.000000Z 字数 2236 阅读 647

活动接口文档 -- 获取活动里的帖子或单个帖子

好热闹 活动


获取活动的帖子列表


只有加入活动的用户才能看到回帖
接口有 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

  1. {
  2. "username":"18512345678",
  3. "password":"123456",
  4. "topic_type":"qa",
  5. }

cURL Example

  1. # ID 为 1945 的活动里问答类型的帖子,第 2 页。
  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[1] Status Code
message Failure Message
topics 帖子列表 Topic
posts 返回前三个回帖
  1. {
  2. "ret":"ok", # ok, 成功; failed, 失败
  3. "reason":"",
  4. "status":0,
  5. "message":"",
  6. "topics": [{
  7. "username": "12345678",
  8. "nickname": "\u5c0f\u4e8c",
  9. "id": 4,
  10. "title": "Online Activity Testing 001",
  11. "content": "You need a fully-functional OAuth2 provider.."
  12. "create_time": "2016-04-01 11:39:58",
  13. "last_replied": "2016-04-01 11:39:58",
  14. "click":4,
  15. "reply_count":2,
  16. "topic_type":"qa",
  17. "pictures":["resource.haorenao.cn/pic1.jpg",],
  18. "videos":["resource.haorenao.cn/video1.mp4",],
  19. "topic_type_display":"问答",
  20. "posts": [{
  21. "id": 1,
  22. "nickname": "13543296793",
  23. "username": "13543296793",
  24. "content": "What you need to...",
  25. }..]
  26. }...]
  27. }

获取单个帖子


只有加入活动的用户才能看到回帖
接口有 5 分钟的缓存

Method and URL Structure

Method Resource URL
GET /activity/${id}/topic

Request Parameters

Name Description Required Default
username 用户名 YES
password 密码 YES

cURL Example

  1. # ID 为 1898 的帖子
  2. $ 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 的中文显示
  1. {
  2. "ret":"ok", # ok, 成功; failed, 失败
  3. "reason":"",
  4. "status":0,
  5. "message":"",
  6. "topic": {
  7. "username": "12345678",
  8. "nickname": "\u5c0f\u4e8c",
  9. "id": 1898,
  10. "title": "Online Activity Testing 001",
  11. "content": "You need a fully-functional OAuth2 provider.."
  12. "create_time": "2016-04-01 11:39:58",
  13. "last_replied": "2016-04-01 11:39:58",
  14. "pictures":["resource.haorenao.cn/pic1.jpg",],
  15. "videos":["resource.haorenao.cn/video1.mp4",],
  16. "click":4,
  17. "reply_count":2,
  18. "topic_type":"qa",
  19. "topic_type_display":"问答",
  20. }
  21. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注