分享几个常用的github-api。
以我的github项目为例,api完整链接如下。
https://api.github.com/repos/momodiy/sudoku/commits?per_page=10&sha=master
想要查询你自己的项目,只需将momodiy
替换成你要查询的用户id,sudoku
替换成你要查询的该用户的项目即可。
依旧是以我的github账户为例,可查看用户的详细信息,返回信息如下json。
https://api.github.com/users/momodiy
{
"login": "momodiy",
"id": 20580248,
"node_id": "MDQ6VXNlcjIwNTgwMjQ4",
"avatar_url": "https://avatars1.githubusercontent.com/u/20580248?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/momodiy",
"html_url": "https://github.com/momodiy",
"followers_url": "https://api.github.com/users/momodiy/followers",
"following_url": "https://api.github.com/users/momodiy/following{/other_user}",
"gists_url": "https://api.github.com/users/momodiy/gists{/gist_id}",
"starred_url": "https://api.github.com/users/momodiy/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/momodiy/subscriptions",
"organizations_url": "https://api.github.com/users/momodiy/orgs",
"repos_url": "https://api.github.com/users/momodiy/repos",
"events_url": "https://api.github.com/users/momodiy/events{/privacy}",
"received_events_url": "https://api.github.com/users/momodiy/received_events",
"type": "User",
"site_admin": false,
"name": "Steven Lee",
"company": null,
"blog": "momodiy.github.io",
"location": null,
"email": null,
"hireable": true,
"bio": "better me",
"public_repos": 15,
"public_gists": 0,
"followers": 2,
"following": 13,
"created_at": "2016-07-21T13:57:31Z",
"updated_at": "2018-07-02T12:28:42Z"
}
https://api.github.com/users/momodiy/followers
想查看其他用户的只需将momodiy替换成你需要查看的用户id即可。
https://api.github.com/users/momodiy/following
想查看其他用户的只需将momodiy替换成你需要查看的用户id即可。
https://api.github.com/users/momodiy/starred
想查看其他用户的只需将momodiy替换成你需要查看的用户id即可。
idea来自github中官方vue项目~
@freeframstye
的评论以
https://developer.github.com/v3/activity/watching/
第一条API的用法为例。
返回一个数组,包含每一个对该项目watch的用户列表。
GET /repos/:owner/:repo/subscribers
完整api为https://api.github.com
拼接上文档中给出的url。
:owner
替换为项目作者:repo
替换为项目名称https://api.github.com/repos/momodiy/sudoku/subscribers