[关闭]
@bergus 2016-03-02T18:02:21.000000Z 字数 6337 阅读 1573

API 设计文档

API


活动报名 APIs v1

活动以及活动报名的相关借口

活动报名

URL

POST /activity/enroll

TOKEN

required

INPUT

  1. {
  2. "activity_id": "4eb3a4ff-ad0c-4a03-963c-1a9e4290863e" //string:required, 活动Id
  3. "attrs":{ //基本属性
  4. "nickname": "irons", //string:required, 昵称
  5. "mobile": "86-18621936702", //string:required, 电话号码
  6. "gender": "female", //string:required, 性别
  7. "birthday": "2015-12-24", //string:required, 生日
  8. "job": "学生", //string:required, 职业[学生, 上班族, 自由职业者, 全职主妇, 网红, 其他 ]
  9. },
  10. "extras":{ //可扩展属性
  11. "invitation_code": "123456", //string:option, 邀请码,meiId
  12. "front_photos": ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,正面照
  13. "profile_photos": ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,侧面照
  14. "apply_reason": "申请理由" //string:required,参加活动的理由,改善
  15. },
  16. }

OUTPUT

  1. {
  2. "code":"00000"
  3. "data":{
  4. "message":"附加信息,比如错误提醒以及,变更提醒"
  5. }
  6. }
  7. {
  8. "code":"11201",
  9. "message":"用户已经注册该活动"
  10. }

ERROR

CURL

  1. curl\
  2. -X POST\
  3. -d '{"activity_id":"wefddw","mobile":"86-18621936702","gender":"female","birthday":"2015-12-24","job":"学生","invitation_code":"221ss","front_photo":["http://qiniu.com/fefw/ddw.jpg","http://qiniu.com/dee/fefew.jpg"],"profile_photo": ["http://qiniu.com/fefw/ddw.jpg","http://qiniu.com/dee/fefew.jpg"],"activity_id":"dwfeww","apply_reason":"申请理由"}'\
  4. -i http://localhost:3001/v1/activity/enroll\
  5. -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0MzM0MjkwNjgsImlhdCI6MTQzMzE2OTg2OCwic3ViIjoiNTU2YzY0OTNkZjhlNTY2NDViM2NmYjdlIn0.WA3UlkU2gDH5UCZ_q4abUSBTMEuY21ytAWgyUfPInEaYlJaI1Iav23yHoSHLggloV4emHf6f2hJuV-3LQuGMQfO60yC4zkgeBvBjjXm6808K_ZsuWMtzco8sTjV-2y6VbHb-EnUItVNE-YJuRiP_i0A0H3gJb7IfsSubOz63G3bXvCFUFxPy9Y7DPmpocLXexltf_-EKbyMNHHob5Nll0XOnb3dMZnXU9QhXnx1kT-2uexzdDVsWEZC6UexmRS9b86_oZ4tfGCcNG-Tg9Bl1ole_Yp_9fUBvqA9o-5gsEzFcc0atdEyM1ytFXAaO5SVCqbOnvRKKOdCrduGLth2w"

用户是否注册

URL

POST /activity/is_enrolled

TOKEN

required

INPUT

  1. {
  2. "activity_id":"4eb3a4ff-ad0c-4a03-963c-1a9e4290863e",
  3. }

OUTPUT

  1. {
  2. "code":"00000",
  3. "data":{
  4. "is_enrolled":false,
  5. },
  6. }
  7. {
  8. "code":"11203",
  9. "message":"活动不存在!"
  10. }

ERROR

CURL

  1. curl -i http://localhost:3001/v1/activity/is_enrolled\
  2. -d '{"activity_id":"bhbdhbvdvfhfvbdfhd"}'\
  3. -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0MzM0MjkwNjgsImlhdCI6MTQzMzE2OTg2OCwic3ViIjoiNTU2YzY0OTNkZjhlNTY2NDViM2NmYjdlIn0.WA3UlkU2gDH5UCZ_q4abUSBTMEuY21ytAWgyUfPInEaYlJaI1Iav23yHoSHLggloV4emHf6f2hJuV-3LQuGMQfO60yC4zkgeBvBjjXm6808K_ZsuWMtzco8sTjV-2y6VbHb-EnUItVNE-YJuRiP_i0A0H3gJb7IfsSubOz63G3bXvCFUFxPy9Y7DPmpocLXexltf_-EKbyMNHHob5Nll0XOnb3dMZnXU9QhXnx1kT-2uexzdDVsWEZC6UexmRS9b86_oZ4tfGCcNG-Tg9Bl1ole_Yp_9fUBvqA9o-5gsEzFcc0atdEyM1ytFXAaO5SVCqbOnvRKKOdCrduGLth2w"

创建活动

URL

POST /activity/create

TOKEN

not required

INPUT

  1. {
  2. "activity_id":"cfgvhjbk",
  3. "attrs":{
  4. "name":"美白",
  5. "title":"第一季",
  6. "wechat":"12321",
  7. "city":"上海 北京",
  8. "start_at":45678933,
  9. "end_at":3221426,
  10. },
  11. "extras":{
  12. "apply_reason_example": "申请理由范例",
  13. "front_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
  14. "profile_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
  15. "banners":[
  16. {
  17. "img": "http://www.baidu.com/1122.jpg",
  18. "target_type": "web",
  19. "target_id": "12345",
  20. },
  21. {
  22. "img": "http://www.baidu.com/1122.jpg",
  23. "target_type": "web",
  24. "target_id": "1234532",
  25. },
  26. ],
  27. },
  28. "enroll_num":123,
  29. "fund_balance":22233.53,
  30. }

OUTPUT

  1. {
  2. "code":"00000",
  3. "data":{
  4. "message":"活动创建成功",
  5. },
  6. }
  7. {
  8. "code":"10002",
  9. "message":"格式化转化错误!"
  10. }

ERROR

none

CURL

  1. curl\
  2. -i http://localhost:3001/v1/activity/create\
  3. -d '{
  4. "attrs":{
  5. "name":"美白",
  6. "title":"第一季",
  7. "wechat":"12321",
  8. "city":"上海 北京",
  9. "start_at":45678933,
  10. "end_at":3221426,
  11. },
  12. "extras":{
  13. "apply_reason_example": "申请理由范例",
  14. "front_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
  15. "profile_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
  16. "banners":[
  17. {
  18. "img": "http://www.baidu.com/1122.jpg",
  19. "target_type": "web",
  20. "target_id": "12345",
  21. },
  22. {
  23. "img": "http://www.baidu.com/1122.jpg",
  24. "target_type": "web",
  25. "target_id": "1234532",
  26. },
  27. ]
  28. },
  29. "enroll_num":123,
  30. "fund_balance":22233.53,
  31. }'

活动信息

URL

POST /activity/get_info

TOKEN

not required

INPUT

  1. {
  2. "activity_id":"test", //string:required
  3. "extras":{}, //以后升级时需要的扩展属性
  4. }

OUTPUT

  1. {
  2. "code":"00000"
  3. "data":{
  4. "attrs":{
  5. "title": "第一季(仅限上海)", //string:required, 标题
  6. "name": "活动名字", //string:required.活动名字
  7. "city": "上海"
  8. "wechat": "wdwww", //string:required, 微信公众号
  9. "start_at": 1456305724, //timestamp:required,活动开始时间
  10. "end_at": 1456305724, //timestamp:required,活动结束时间
  11. },
  12. "extras":{
  13. "banners": [ //string:required, 标题页
  14. {
  15. "img" : "http://qiniu.com/sdddww/dwe.jpg", //string:required, 图片链接
  16. "target_type": "web", //string:required, 目标类型
  17. "target_id" : "http://qiniu.com/sdddww/dwe.jpg", //string:required, 目标链接
  18. },
  19. {
  20. "img" : "http://qiniu.com/sdddww/dwe.jpg",
  21. "target_type": "web",
  22. "target_id" : "http://qiniu.com/sdddww/dwe.jpg",
  23. },
  24. ],
  25. "apply_reason_example": "申请理由范例", //string:required,参加活动的理由,改善建议
  26. "front_photo_examples": ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,正面照
  27. "profile_photo_examples": ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,侧面照
  28. },
  29. "enroll_num": 1221, //报名人数
  30. "fund_balance": 12334223.43, //string:required, 剩余基金
  31. "update_at": 45673232, //timestamp:required, 活动信息更新时间戳
  32. "status" 1, // int:required,活动当前的状态,{-1:下线状态,1:上线状态}
  33. }
  34. }
  35. {
  36. "code":"11203",
  37. "message":"活动不存在!"
  38. }

ERROR

CURL

  1. curl\
  2. -X POST\
  3. -i http://localhost:3001/v1/activity/get_info \
  4. -d '{"activity_id":"test"}'

获得活动列表

URL

POST /activity/get_activities

TOKEN

not required

INPUT

  1. {
  2. "last":"234",// 上次的num数
  3. "limit":21, // 需要获得至少limit条数据,limit不能小于1
  4. "extras":{}, // 以后扩展功能,"is_brief":true, 代表是简略的还是全部的信息,默认简略内容
  5. }

OUTPUT

  1. {
  2. "code":"00000"
  3. "data":{
  4. "activities": [
  5. {
  6. "title": "第一季(仅限上海)", // 本季活动的标题
  7. "status": 1, //-1:活动已下线,下线不显示;1:活动上线
  8. "num":1, // 活动次数
  9. "activity_id":"56789567" // 报名活动的Id
  10. "update_at": 23432112 // 活动更新时间戳
  11. },
  12. {
  13. "title": "第一季(仅限上海)", // 本季活动的标题
  14. "status": 1,
  15. "activity_id":"56789567"
  16. "num":2
  17. "update_at": 23432112
  18. }
  19. ]
  20. }
  21. }
  22. {
  23. "code":"10002",
  24. "message":"数据参数转化错误"
  25. }

ERROR

none

CURL

  1. curl\
  2. -X POST\
  3. -d '{"last":"2342","limit":2}'
  4. -i http://localhost:3001/v1/activity/get_activities

获得活动体验

URL

POST /activity/get_experiences

TOKEN

not required

INPUT

  1. {
  2. "last":"上次的体验ID",
  3. "limit":1,
  4. "extras":{},
  5. }

OUTPUT

  1. {
  2. "code":"00000",
  3. "data":{
  4. "experiences":[
  5. {
  6. "user_id":"23432",
  7. "activity_name":"美白",
  8. "activity_title":"第一季",
  9. "activity_balance":12321.12,
  10. "extras":{},
  11. },
  12. {
  13. "user_id":"23432",
  14. "activity_name":"美白",
  15. "activity_title":"第一季",
  16. "activity_balance":12321.12,
  17. "extras":{},
  18. },
  19. ]
  20. },
  21. }
  22. {
  23. "code":"10002",
  24. "message":"数据参数转化错误"
  25. }

ERROR

none

CURL

  1. curl\
  2. -X POST\
  3. -i http://localhost:3001/v1/activity/get_experiences\
  4. -d '{"last":"2342","limit":2}'
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注