我如何使用github API获取所有github问题? [英] How can I get all the github issues using github API?

查看:601
本文介绍了我如何使用github API获取所有github问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在尝试使用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 ,这会给你提供未解决问题的数量。



我不确定是否有办法解决包括未打开问题的问题数量。

b
$ b

原始回复



您需要 paginate


请求返回多个项目默认分为30个项目。您可以使用?page 参数指定更多页面。对于某些资源,您还可以使用?per_page 参数将自定义页面大小设置为100。请注意,由于技术原因,并非所有端点都遵守?per_page 参数,请参阅 events

  $ curl'https://api.github.com / user / repos?page = 2& per_page = 100'



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:

GET /repos/:owner/:repo

The JSON response from this endpoint includes two relevant keys:

  • has_issues, which will be true or false, and
  • open_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.

Original response

You'll need to 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'

这篇关于我如何使用github API获取所有github问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆