队伍信息
跟斌叔学编程
创建队伍
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
{
"name":"测试队伍",
"avatar": "img.png",
"announcement":"我是公告"
}
cURL Example
curl -X POST -H 'Authorization: Token 521b92efb730acd59cf80cc3d6001efae366a2e7' -d data{...}
http://127.0.0.1:8000/server/userinfo/group_create/
JSON Response
{
"pk": 1,
"name": "测试队伍",
"avatar": "img.png",
"announcement": "我是公告",
"approve": true,
"member_number": 1
}
查看我的队伍
Method and Url Structure
Method |
Resource URL |
GET |
/server/userinfo/my_group/ |
cURL Example
curl -X GET -H 'Authorization: Token 521b92efb730acd59cf80cc3d6001efae366a2e7' http://localhost:8000/server/userinfo/my_group/
JSON Response
{
"pk": 1,
"name": "测试队伍",
"avatar": "img.png",
"announcement": "我是公告",
"approve": true,
"member_number": 1,
"group_member": [
{
"owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo",
"pk": 1,
"name": "尼古拉斯·刘能",
"leader": true,
"avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
}
],
"price_info": [
"尼古拉斯·刘能开团成功, 成功砍价11元。"
]
}
修改队伍信息
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
{
"name":"改改改",
"avatar": "img.png",
"announcement":"我是公告"
}
cURL Example
curl -X PUT/PATCH -H 'Authorization: Token 521b92efb730acd59cf80cc3d6001efae366a2e7' -d data{...}
http://127.0.0.1:8000/server/userinfo/groups/1/
JSON Response
{
"pk": 1,
"name": "改改改",
"avatar": "img.png",
"announcement": "我是公告",
"approve": true,
"member_number": 1
}
加入队伍
Method and Url Structure
Method |
Resource URL |
GET |
/server/userinfo/join_group/${pk}/ |
cURL Example
curl -X POST -H 'Authorization: Token tester' -d data{...}
http://127.0.0.1:8000/server/userinfo/join_group/1/
JSON Response
{
"pk": 1,
"name": "改改改",
"avatar": "img.png",
"announcement": "我是公告",
"approve": true,
"member_number": 2,
"group_member": [
{
"owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo",
"pk": 1,
"name": "尼古拉斯·刘能",
"leader": true,
"avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
},
{
"owner": "tester001",
"pk": 2,
"name": "测试1号",
"leader": false,
"avatar": "img.png"
}
],
"price_info": [
"尼古拉斯·刘能开团成功, 成功砍价11元。",
"测试1号\b进入团队,成功帮团队砍价11元。"
]
}
查看队伍信息
Method and Url Structure
Method |
Resource URL |
GET |
/server/userinfo/group_detail/${pk}/ |
cURL Example
curl -X GET -H 'Authorization: Token tester001' http://localhost:8000/server/userinfo/group_detail/1/
JSON Response
{
"pk": 1,
"name": "改改改",
"avatar": "img.png",
"announcement": "我是公告",
"approve": true,
"member_number": 2,
"group_member": [
{
"owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo",
"pk": 1,
"name": "尼古拉斯·刘能",
"leader": true,
"avatar": "https://static1.bcjiaoyu.com/head7@3x.png"
},
{
"owner": "tester001",
"pk": 2,
"name": "测试1号",
"leader": false,
"avatar": "img.png"
}
],
"price_info": [
"尼古拉斯·刘能开团成功, 成功砍价11元。",
"测试1号\b进入团队,成功帮团队砍价11元。"
]
}
队伍列表
Method and Url Structure
Method |
Resource URL |
GET |
/server/userinfo/groups/ |
cURL Example
curl -X GET -H 'Authorization: Token tester001' -d data{...}
http://127.0.0.1:8000/server/userinfo/groups/
JSON Response
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 1,
"name": "改改改",
"avatar": "img.png",
"announcement": "我是公告",
"approve": true,
"member_number": 2
}
]
}