[关闭]
@fuyb1986 2016-04-21T07:23:52.000000Z 字数 3579 阅读 543

活动接口文档 -- 创建、发帖、回帖

好热闹 活动


创建活动

Method and URL Structure

Method Resource URL
POST /activity/activiy_create/

Request Parameters


参数以 application/json 格式,在 request.body 中传递给接口

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

Activity Data Member List

Name Description Required Max Length Default
subject 主题 YES 64
intro 描述 YES
price 价格 YES
max_member 人数上限 YES
min_member 人数下限 YES
has_offline 是否有线下活动 NO false
has_live_video 是否视频直播 NO false
start_time 开始时间 YES
complete_time 结束时间 YES
crowd 适合人群 NO

Request

  1. {
  2. "username":"18012345678",
  3. "password":"123456",
  4. "activity":{
  5. "subject": "Online Activity Testing 001",
  6. "intro": "You need a fully-functional a middleware that",
  7. "price": 3.0,
  8. "max_member": 10,
  9. "min_member": 3,
  10. "has_offline": false,
  11. "has_live_video": false,
  12. "start_time":"2016-04-12 13:00",
  13. "complete_time":"2016-05-12 14:00",
  14. "crowd":u"学生",
  15. }
  16. }

cURL Example

  1. $ curl -H "Accept: application/json" -H "Content-Type: applcaitonjson" -X POST \
  2. --data '{
  3. "activity": {
  4. "subject": "Online Activity Testing 001",
  5. "intro": "You need a fully-functional
  6. OAuth2 provider which is able to release access tokens: just follow the steps in the part 1 of the tutorial. To enable OAuth2 token authentication you need a middleware that",
  7. "price": 3.0,
  8. "max_member": 10,
  9. "min_member": 3,
  10. "has_offline": false,
  11. "has_live_video": false,
  12. }
  13. }' \
  14. 'http://www.haorenao.cn/activity/activity_create/'

JSON Response

Name Description NOTE
ret 标识是否成功。 @Depracted
reason 失败原因 @Depracted
status[1] Status Code
message Failure Message
  1. {
  2. "ret":"ok", # ok, 成功; failed, 失败
  3. "reason":"",
  4. "status":0,
  5. "message":"",
  6. }

发帖

Method and URL Structure

Method Resource URL
POST /activity/{activity_id}/topic_create/

Request Parameters


参数以 application/json 格式,在 request.body 中传递给接口

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

Activity Data Member List

Name Description Required Max Length Default
title 标题 YES 64
content 描述 YES
topic_type 类型 YES 16 teaching
Topic Type
Name Description Note
teaching 教学贴 只有创建活动的用户能发教学贴
qa 提问贴 加入活动的用户可发提问贴, 创建用户默认加入

Request

  1. {
  2. "username":"18012345678",
  3. "password":"123456",
  4. "topic":{
  5. "title": "Online Activity Testing 001",
  6. "content": "You need a fully-functional a middleware that",
  7. "pictures":"pic1,pic2,pic3",
  8. "videos":"1.mp4,2.mp4,3.mp4",
  9. "topic_type": "qa",
  10. }
  11. }

cURL Example

  1. $ curl -H "Accept: application/json" -H "Content-Type: applcaitonjson" -X POST \
  2. --data '{
  3. "topic": {
  4. "title":"This is testing teaching topic 001",
  5. "content":"You will likely use the django.contrib.auth.backends.ModelBackend
  6. along with the OAuth2 backend (or you might not be able to log in into the admin), only pay attention to the order in which Django processes authentication backends.",
  7. "topic_type":"teaching",
  8. }
  9. }' 'http://www.haorenao.cn/activity/123/topic_create/'

JSON Response

Name Description NOTE
ret 标识是否成功。 @Depracted
reason 失败原因 @Depracted
status Status Code
message Failure Message
  1. {
  2. "ret":"ok", # ok, 成功; failed, 失败
  3. "reason":"",
  4. "status":0,
  5. "message":"",
  6. }

回帖

只有加入活动的用户能回帖

Method and URL Structure

Method Resource URL
POST /activity/{topic_id}/topic_reply/

Request Parameters

参数以 application/json 格式,在 request.body 中传递给接口

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

Activity Data Member List

Name Description Required Max Length Default
content 描述 YES

Request

  1. {
  2. "username":"18012345678",
  3. "password":"123456",
  4. "post":{
  5. "content": "You need a fully-functional a middleware that",
  6. "pictures":"pic1,pic2,pic3",
  7. }
  8. }

cURL Example

  1. $ curl -H "Accept: application/json" -H "Content-Type: applcaitonjson" -X POST \
  2. --data '{
  3. "post": {
  4. "content":"What you need to do is decide when and how those token objects should be created. In your app, does every user automatically get a token? Or only certain authorized users? Or only when they specifically request one?"
  5. }
  6. }' 'http://www.haorenao.cn/activity/1/topic_reply/'

JSON Response

Name Description NOTE
ret 标识是否成功。 @Depracted
reason 失败原因 @Depracted
status Status Code
message Failure Message
  1. {
  2. "ret":"ok", # ok, 成功; failed, 失败
  3. "reason":"",
  4. "status":0,
  5. "message":"",
  6. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注