[关闭]
@fuyb1986 2016-05-17T08:49:31.000000Z 字数 2157 阅读 568

活动接口文档 -- 更新帖子和回帖

好热闹 活动


更新帖子

Method and URL Structure

Method Resource URL
POST /activity/${topic_id}/topic_update/

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
pictures 图片列表 NO
vidoes 视频列表 NO

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. }
  10. }

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. }
  8. }' 'http://www.haorenao.cn/activity/123/topic_update/'

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/${post_id}/post_update/

Request Parameters

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

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

Activity Data Member List

Name Description Required Default t
content 内容 YES
pictures 图片列表 NO
vidoes 视频列表 NO

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. "videos":"1234.mp4,"
  8. }
  9. }

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. "pictures":"pic1.jpg,pic2.jpg",
  6. "vidoes":"1.mp4,2.mp4",
  7. }
  8. }' 'http://www.haorenao.cn/activity/1935/post_update/'

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. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注