[关闭]
@JackieQu 2018-04-18T18:28:47.000000Z 字数 2989 阅读 289

队伍信息

跟斌叔学编程


创建队伍

Method and Url Structure

Method Resource URL
POST /server/userinfo/group_create/

Request and Parameters

Name Description Required Default
name 队伍名称 YES
avatar 队伍头像 NO
announcement 队伍公告 NO

Request

  1. {
  2. "name":"测试队伍",
  3. "avatar": "img.png",
  4. "announcement":"我是公告"
  5. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 521b92efb730acd59cf80cc3d6001efae366a2e7' -d data{...}
  2. http://127.0.0.1:8000/server/userinfo/group_create/

JSON Response

  1. {
  2. "pk": 1,
  3. "name": "测试队伍",
  4. "avatar": "img.png",
  5. "announcement": "我是公告",
  6. "approve": true,
  7. "member_number": 1
  8. }

查看我的队伍

Method and Url Structure

Method Resource URL
GET /server/userinfo/my_group/

cURL Example

  1. curl -X GET -H 'Authorization: Token 521b92efb730acd59cf80cc3d6001efae366a2e7' http://localhost:8000/server/userinfo/my_group/

JSON Response

  1. {
  2. "pk": 1,
  3. "name": "测试队伍",
  4. "avatar": "img.png",
  5. "announcement": "我是公告",
  6. "approve": true,
  7. "member_number": 1,
  8. "group_member": [
  9. {
  10. "owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo",
  11. "pk": 1,
  12. "name": "尼古拉斯·刘能",
  13. "leader": true,
  14. "avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
  15. }
  16. ],
  17. "price_info": [
  18. "尼古拉斯·刘能开团成功, 成功砍价11元。"
  19. ]
  20. }

修改队伍信息

Method and Url Structure

Method Resource URL
PUT/PATCH /server/userinfo/groups/${pk}/

Request and Parameters

Name Description Required Default
name 队伍名称 YES
avatar 队伍头像 NO
announcement 队伍公告 NO

Request

  1. {
  2. "name":"改改改",
  3. "avatar": "img.png",
  4. "announcement":"我是公告"
  5. }

cURL Example

  1. curl -X PUT/PATCH -H 'Authorization: Token 521b92efb730acd59cf80cc3d6001efae366a2e7' -d data{...}
  2. http://127.0.0.1:8000/server/userinfo/groups/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "name": "改改改",
  4. "avatar": "img.png",
  5. "announcement": "我是公告",
  6. "approve": true,
  7. "member_number": 1
  8. }

加入队伍

Method and Url Structure

Method Resource URL
GET /server/userinfo/join_group/${pk}/

cURL Example

  1. curl -X POST -H 'Authorization: Token tester' -d data{...}
  2. http://127.0.0.1:8000/server/userinfo/join_group/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "name": "改改改",
  4. "avatar": "img.png",
  5. "announcement": "我是公告",
  6. "approve": true,
  7. "member_number": 2,
  8. "group_member": [
  9. {
  10. "owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo",
  11. "pk": 1,
  12. "name": "尼古拉斯·刘能",
  13. "leader": true,
  14. "avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
  15. },
  16. {
  17. "owner": "tester001",
  18. "pk": 2,
  19. "name": "测试1号",
  20. "leader": false,
  21. "avatar": "img.png"
  22. }
  23. ],
  24. "price_info": [
  25. "尼古拉斯·刘能开团成功, 成功砍价11元。",
  26. "测试1号\b进入团队,成功帮团队砍价11元。"
  27. ]
  28. }

查看队伍信息

Method and Url Structure

Method Resource URL
GET /server/userinfo/group_detail/${pk}/

cURL Example

  1. curl -X GET -H 'Authorization: Token tester001' http://localhost:8000/server/userinfo/group_detail/1/

JSON Response

  1. {
  2. "pk": 1,
  3. "name": "改改改",
  4. "avatar": "img.png",
  5. "announcement": "我是公告",
  6. "approve": true,
  7. "member_number": 2,
  8. "group_member": [
  9. {
  10. "owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo",
  11. "pk": 1,
  12. "name": "尼古拉斯·刘能",
  13. "leader": true,
  14. "avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
  15. },
  16. {
  17. "owner": "tester001",
  18. "pk": 2,
  19. "name": "测试1号",
  20. "leader": false,
  21. "avatar": "img.png"
  22. }
  23. ],
  24. "price_info": [
  25. "尼古拉斯·刘能开团成功, 成功砍价11元。",
  26. "测试1号\b进入团队,成功帮团队砍价11元。"
  27. ]
  28. }

队伍列表

Method and Url Structure

Method Resource URL
GET /server/userinfo/groups/

cURL Example

  1. curl -X GET -H 'Authorization: Token tester001' -d data{...}
  2. http://127.0.0.1:8000/server/userinfo/groups/

JSON Response

  1. {
  2. "count": 1,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 1,
  8. "name": "改改改",
  9. "avatar": "img.png",
  10. "announcement": "我是公告",
  11. "approve": true,
  12. "member_number": 2
  13. }
  14. ]
  15. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注