活动接口文档 -- 创建、发帖、回帖
好热闹
活动
创建活动
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
{
"username":"18012345678",
"password":"123456",
"activity":{
"subject": "Online Activity Testing 001",
"intro": "You need a fully-functional a middleware that",
"price": 3.0,
"max_member": 10,
"min_member": 3,
"has_offline": false,
"has_live_video": false,
"start_time":"2016-04-12 13:00",
"complete_time":"2016-05-12 14:00",
"crowd":u"学生",
}
}
cURL Example
$ curl -H "Accept: application/json" -H "Content-Type: applcaitonjson" -X POST \
--data '{
"activity": {
"subject": "Online Activity Testing 001",
"intro": "You need a fully-functional
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",
"price": 3.0,
"max_member": 10,
"min_member": 3,
"has_offline": false,
"has_live_video": false,
}
}' \
'http://www.haorenao.cn/activity/activity_create/'
JSON Response
Name |
Description |
NOTE |
ret |
标识是否成功。 |
@Depracted |
reason |
失败原因 |
@Depracted |
status |
Status Code |
|
message |
Failure Message |
|
{
"ret":"ok", # ok, 成功; failed, 失败
"reason":"",
"status":0,
"message":"",
}
发帖
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
{
"username":"18012345678",
"password":"123456",
"topic":{
"title": "Online Activity Testing 001",
"content": "You need a fully-functional a middleware that",
"pictures":"pic1,pic2,pic3",
"videos":"1.mp4,2.mp4,3.mp4",
"topic_type": "qa",
}
}
cURL Example
$ curl -H "Accept: application/json" -H "Content-Type: applcaitonjson" -X POST \
--data '{
"topic": {
"title":"This is testing teaching topic 001",
"content":"You will likely use the django.contrib.auth.backends.ModelBackend
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.",
"topic_type":"teaching",
}
}' 'http://www.haorenao.cn/activity/123/topic_create/'
JSON Response
Name |
Description |
NOTE |
ret |
标识是否成功。 |
@Depracted |
reason |
失败原因 |
@Depracted |
status |
Status Code |
|
message |
Failure Message |
|
{
"ret":"ok", # ok, 成功; failed, 失败
"reason":"",
"status":0,
"message":"",
}
回帖
只有加入活动的用户能回帖
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
{
"username":"18012345678",
"password":"123456",
"post":{
"content": "You need a fully-functional a middleware that",
"pictures":"pic1,pic2,pic3",
}
}
cURL Example
$ curl -H "Accept: application/json" -H "Content-Type: applcaitonjson" -X POST \
--data '{
"post": {
"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?"
}
}' 'http://www.haorenao.cn/activity/1/topic_reply/'
JSON Response
Name |
Description |
NOTE |
ret |
标识是否成功。 |
@Depracted |
reason |
失败原因 |
@Depracted |
status |
Status Code |
|
message |
Failure Message |
|
{
"ret":"ok", # ok, 成功; failed, 失败
"reason":"",
"status":0,
"message":"",
}