分享几个常用的github-api。
1.查询项目最新提交信息
以我的github项目为例,api完整链接如下。
https://api.github.com/repos/lifei-2019/react-demos/commits?per_page=10&sha=master
可选参数
per_page 查询条数
sha 查询分支
想要查询你自己的项目,只需将lifei-2019替换成你要查询的用户id,react-demos替换成你要查询的该用户的项目即可。
2.查询用户基本信息
依旧是以我的github账户为例,可查看用户的详细信息,返回信息如下json。
https://api.github.com/users/lifei-2019
1 | { |
3.获取用户followers列表
https://api.github.com/users/lifei-2019/followers
想查看其他用户的只需将lifei-2019替换成你需要查看的用户id即可。
4.获取用户following列表
https://api.github.com/users/lifei-2019/following
想查看其他用户的只需将lifei-2019替换成你需要查看的用户id即可。
5.获取用户stared项目列表
https://api.github.com/users/lifei-2019/starred
想查看其他用户的只需将lifei-2019替换成你需要查看的用户id即可。
6.列出观察者
返回一个数组,包含每一个对该项目watch的用户列表。
1.语法
GET /repos/:owner/:repo/subscribers
完整api为https://api.github.com拼接上文档中给出的url。
2.关键参数
:owner 替换为项目作者
:repo 替换为项目名称
3.demo
https://api.github.com/repos/lifei-2019/react-demos/subscribers
7.其他
- 本文作者: Raphael_Li
- 本文链接: https://lifei-2019.github.io/github-api/
- 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!