你好,我正在尝试使用Angular和Github Rest API获取存储库的问题数量,但问题在于我只得到了30个问题,即使该存储库中存在更多的问题。 请帮我想出解决办法。 我使用以下REST Api来获取问题。
https://api.github.com/repos/vmg/redcarpet/issues?state=all
你好,我正在尝试使用Angular和Github Rest API获取存储库的问题数量,但问题在于我只得到了30个问题,即使该存储库中存在更多的问题。 请帮我想出解决办法。 我使用以下REST Api来获取问题。
https://api.github.com/repos/vmg/redcarpet/issues?state=all
如果您只想知道问题的数量,我认为最接近的方法是使用获取存储库终端:
GET /repos/:owner/:repo
此终端的JSON响应包括两个相关键:
has_issues
,其值为true
或false
,以及open_issues_count
,它应该给出打开的问题数量。我不确定是否有任何方法可以获得包括未打开的问题在内的问题数量。
您需要进行分页:
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'
open_issues_count
将为您提供Issues + PRs的计数,因为GitHub将PR视为问题。 - Rohan Lekhwani