官方文档:https://docs.github.com/en/rest/reference
1、申请github api token
2、在请求header中添加Authorization和Accept,例如:
用户 用户集合 请求说明显示所有github用户信息,默认按id递增。
| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| since | integer | query | A user ID. only return users with an ID greater than this ID. |
| per_page | integer | query | Results per page (max 100)Default: 30 |
请求url:https://api.github.com/users?since=100
返回响应 获取某个用户信息 请求说明| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| username | string | path |
请求url:https://api.github.com/users/mojombo
返回响应 查看用户的关注/被关注 请求说明https://api.github.com/users/USERNAME/following
请求url:https://api.github.com/users/mojombo/following
返回响应 仓库 仓库集合 请求说明查看所有仓库
| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| since | integer | query | A repository ID. only return repositories with an ID greater than this ID. |
请求url:https://api.github.com/repositories?since=824
返回响应 列举仓库信息 请求说明显示某组织所有的仓库信息
https://api.github.com/orgs/ORG/repos
| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| org | string | path | |
| type | string | query | Specifies the types of repositories you want returned. Can be one of all, public, private, forks, sources, member, internal. Note: For GitHub AE, can be one of all, private, forks, sources, member, internal. Default: all. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, type can also be internal. However, the internal value is not yet supported when a GitHub App calls this API with an installation access token. |
| sort | string | query | Can be one of created, updated, pushed, full_name.Default: created |
| direction | string | query | Can be one of asc or desc. Default: when using full_name: asc, otherwise desc |
| per_page | integer | query | Results per page (max 100)Default: 30 |
| page | integer | query | Page number of the results to fetch.Default: 1 |
请求url:https://api.github.com/orgs/nasa/repos?per_page=10
返回响应 仓库贡献人员 请求说明查看某个仓库的贡献者名单
/repos/{owner}/{repo}/contributors
请求url:https://api.github.com/repos/nasa/osal/contributors
返回响应 仓库语言 请求说明查看仓库中不同编程语言的使用量,单位为字节。
/repos/{owner}/{repo}/languages
请求url:https://api.github.com/repos/nasa/osal/languages
返回响应 仓库标签 请求说明查看仓库中的所有标签
/repos/{owner}/{repo}/tags
| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| owner | string | path | |
| repo | string | path | |
| per_page | integer | query | Results per page (max 100)Default: 30 |
| page | integer | query | Page number of the results to fetch.Default: 1 |
请求url:https://api.github.com/repos/nasa/osal/tags
返回响应 仓库话题 请求说明查看仓库中的所有话题
/repos/{owner}/{repo}/topics
请求url:https://api.github.com/repos/nasa/scrub/topics
返回响应 查看用户仓库 请求说明查看某用户的所有仓库信息
/users/{username}/repos
| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| username | string | path | |
| type | string | query | Can be one of all, owner, member.Default: owner |
| sort | string | query | Can be one of created, updated, pushed, full_name.Default: full_name |
| direction | string | query | Can be one of asc or desc. Default: asc when using full_name, otherwise desc |
| per_page | integer | query | Results per page (max 100)Default: 30 |
| page | integer | query | Page number of the results to fetch.Default: 1 |
请求url:https://api.github.com/users/JustinGOSSES/repos
返回响应 分支 请求说明查看仓库的分支
/repos/{owner}/{repo}/branches
| Name | Type | In | Description |
|---|---|---|---|
| accept | string | header | Setting to application/vnd.github.v3+json is recommended. |
| owner | string | path | |
| repo | string | path | |
| protected | boolean | query | Setting to true returns only protected branches. When set to false, only unprotected branches are returned. Omitting this parameter returns all branches. |
| per_page | integer | query | Results per page (max 100)Default: 30 |
| page | integer | query | Page number of the results to fetch.Default: 1 |
请求url:https://api.github.com/repos/nasa/osal/branches
返回响应


