当前用户信息
1、获取用户信息
GET /api/user
curl -X GET -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.LNh2Yi-bA7kh56ZLKrTi2GzMIcDkaMVBc8-I9o_UoLU" "http://192.168.58.13/api/user"
Status: 200 OK
Content-Type: application/json
{
"id": 1,
"login": "adminuser",
"email": "ziling.zhong@hand-china.com",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc",
"active": false,
"admin": true
}
2、操作仓库记录
GET /api/user/feed
curl -X GET -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.p2KhqJ-hl7lVdWawKtowBucWRANmYLv6ZqY64-gE660" "http://192.168.56.21/api/user/feed"
Status: 200 OK
Content-Type: application/json
[
{
"owner": "adminuser",
"name": "drone-test",
"full_name": "adminuser/drone-test",
"number": 1,
"event": "push",
"status": "success",
"created_at": 1487763201,
"started_at": 1487763201,
"finished_at": 1487763227,
"commit": "a90ed69105d3e71aead7939aaa38992f9dae0116",
"branch": "master",
"ref": "refs/heads/master",
"message": "add sig\n",
"author": "adminuser",
"author_avatar": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc",
"author_email": "ziling.zhong@hand-china.com"
},
{
"owner": "adminuser",
"name": "demo",
"full_name": "adminuser/demo",
"number": 2,
"event": "push",
"status": "success",
"created_at": 1487665436,
"started_at": 1487665437,
"finished_at": 1487665461,
"commit": "14e087a32700445b448dd7eb94b90a7142b408e0",
"branch": "master",
"ref": "refs/heads/master",
"message": "Add .drone.yml\n",
"author": "adminuser",
"author_avatar": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc",
"author_email": "ziling.zhong@hand-china.com"
},
{
"owner": "adminuser",
"name": "demo",
"full_name": "adminuser/demo",
"number": 1,
"event": "push",
"status": "success",
"created_at": 1487664930,
"started_at": 1487664930,
"finished_at": 1487664979,
"commit": "5f077cc8e208885f8595b3c03131f0707e65af6d",
"branch": "T23797",
"ref": "refs/heads/T23797",
"message": "Merge branch 'master' of adminuser/demo into T23797\n",
"author": "adminuser",
"author_avatar": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc",
"author_email": "ziling.zhong@hand-china.com"
}
]
3、所属当前用户的已开启WebHook的仓库信息
GET /api/user/repos
curl -X GET -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.p2KhqJ-hl7lVdWawKtowBucWRANmYLv6ZqY64-gE660" "http://192.168.56.21/api/user/repos"
Status: 200 OK
Content-Type: application/json
[
{
"id": 19,
"owner": "adminuser",
"name": "demo",
"full_name": "adminuser/demo",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc",
"link_url": "http://192.168.56.21:10080/adminuser/demo",
"scm": "git",
"clone_url": "http://192.168.56.21:10080/adminuser/demo.git",
"default_branch": "master",
"timeout": 60,
"trusted": false,
"allow_pr": false,
"allow_push": true,
"allow_deploys": false,
"allow_tags": false
},
{
"id": 22,
"owner": "adminuser",
"name": "drone-test",
"full_name": "adminuser/drone-test",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc",
"link_url": "http://192.168.56.21:10080/adminuser/drone-test",
"scm": "git",
"clone_url": "http://192.168.56.21:10080/adminuser/drone-test.git",
"default_branch": "master",
"timeout": 60,
"trusted": false,
"allow_pr": true,
"allow_push": true,
"allow_deploys": false,
"allow_tags": false
}
]
4、所属当前用户的所有仓库信息
GET /api/user/repos/remote
curl -X GET -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.-DN8da-4km95mrXPFvjLNqbffvUBTMZ08befXBpD0L8" "http://192.168.56.21/api/user/repos/remote"
Status: 200 OK
Content-Type: application/json
[
{
"owner": "adminuser",
"name": "test-private",
"full_name": "adminuser/test-private",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc"
},
{
"owner": "adminuser",
"name": "test-public",
"full_name": "adminuser/test-public",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc"
},
{
"owner": "adminuser",
"name": "test-remote",
"full_name": "adminuser/test-remote",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc"
},
{
"owner": "adminuser",
"name": "demo-public",
"full_name": "adminuser/demo-public",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc"
},
{
"owner": "adminuser",
"name": "demo-private",
"full_name": "adminuser/demo-private",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc"
},
{
"owner": "adminuser",
"name": "drone-test",
"full_name": "adminuser/drone-test",
"avatar_url": "https://secure.gravatar.com/avatar/0f656b0b09d16bafa95064e7e9bd83bc"
}
]
5、获取当前用户token
POST /api/user/token
curl -X POST -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.-DN8da-4km95mrXPFvjLNqbffvUBTMZ08befXBpD0L8" "http://192.168.56.21/api/user/token"
Status: 200 OK
Content-Type: text/plain; charset=utf-8
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.-DN8da-4km95mrXPFvjLNqbffvUBTMZ08befXBpD0L8
6、销毁当前用户token
DELETE /api/user/token
curl -X DELETE -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.-DN8da-4km95mrXPFvjLNqbffvUBTMZ08befXBpD0L8" "http://192.168.56.21/api/user/token"
Status: 200 OK
Content-Type: text/plain; charset=utf-8
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZXh0IjoiYWRtaW51c2VyIiwidHlwZSI6InVzZXIifQ.-DN8da-4km95mrXPFvjLNqbffvUBTMZ08befXBpD0L8