如何使用 GitHub API 获取 GitHub 问题的数量?
How can I get the number of GitHub issues using the GitHub API?
你好,我正在尝试使用 angular 和 Github 获取回购的问题数,休息 API,但问题是我只得到 30 个问题,即使更多该回购协议中存在问题。
请帮助我的想法。
我使用下面的 REST Api 来解决问题。
https://api.github.com/repos/vmg/redcarpet/issues?state=all
更新回复
如果您只想要 个 个问题,我认为最接近的是 get repo 端点:
GET /repos/:owner/:repo
来自此端点的 JSON 响应包括两个相关键:
has_issues
,即 true
或 false
,以及
open_issues_count
,这应该给你未决问题的数量。
我不确定有什么方法可以获取问题数量,包括未打开的问题。
原始回复
您需要 paginate:
Requests that return multiple items will be paginated to 30 items by default. You can specify further pages with the ?page
parameter. For some resources, you can also set a custom page size up to 100 with the ?per_page
parameter. Note that for technical reasons not all endpoints respect the ?per_page
parameter, see events for example.
$ curl 'https://api.github.com/user/repos?page=2&per_page=100'
你好,我正在尝试使用 angular 和 Github 获取回购的问题数,休息 API,但问题是我只得到 30 个问题,即使更多该回购协议中存在问题。 请帮助我的想法。 我使用下面的 REST Api 来解决问题。
https://api.github.com/repos/vmg/redcarpet/issues?state=all
更新回复
如果您只想要 个 个问题,我认为最接近的是 get repo 端点:
GET /repos/:owner/:repo
来自此端点的 JSON 响应包括两个相关键:
has_issues
,即true
或false
,以及open_issues_count
,这应该给你未决问题的数量。
我不确定有什么方法可以获取问题数量,包括未打开的问题。
原始回复
您需要 paginate:
Requests that return multiple items will be paginated to 30 items by default. You can specify further pages with the
?page
parameter. For some resources, you can also set a custom page size up to 100 with the?per_page
parameter. Note that for technical reasons not all endpoints respect the?per_page
parameter, see events for example.$ curl 'https://api.github.com/user/repos?page=2&per_page=100'