如何使用GitHub API获取GitHub问题的数量? [英] How can I get the number of GitHub issues using the GitHub API?
问题描述
我正在尝试使用angular和Github Rest API来获取一个回购的发行数量,但是问题是,即使该回购中有更多发行,我也只能得到30个发行. 请帮助我的想法. 我使用下面的REST Api来解决问题.
Hi I am trying to get the number of issues of a repo using angular and Github Rest API, But the problem is that I get only 30 issues even though more issues are there in that repo. Please help me with the idea. I use the below REST Api to get the issues.
https://api.github.com/repos/vmg/redcarpet/issues?state=all
推荐答案
更新后的响应
Updated response
If you just want the number of issues I think the closest you'll get is with the get repo endpoint:
获取/repos/:owner/:repo
GET /repos/:owner/:repo
此端点的JSON响应包括两个相关的键:
The JSON response from this endpoint includes two relevant keys:
-
has_issues
,将是true
或false
,以及 -
open_issues_count
,它应该为您提供未解决问题的数量.
has_issues
, which will betrue
orfalse
, andopen_issues_count
, which should give you the number of open issues.
我不知道有什么办法来解决问题的数量,包括那些尚未解决的问题.
I'm not sure of any way to get the number of issues including ones that aren't open.
您需要分页:
默认情况下,返回多个项目的请求将被分页为30个项目.您可以使用
?page
参数指定其他页面.对于某些资源,您还可以使用?per_page
参数将自定义页面大小设置为最大100.请注意,出于技术原因,并非所有端点都遵守?per_page
参数,请参见事件例子.
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'
这篇关于如何使用GitHub API获取GitHub问题的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!