【问题标题】:How to fetch specific amount of users using github api v3?如何使用 github api v3 获取特定数量的用户?
【发布时间】:2018-12-11 01:18:12
【问题描述】:

当我想使用这个 api 获取 github 用户时:https://api.github.com/users 它给了我正好 46 个用户。我怎样才能获取例如只有 10 个?

【问题讨论】:

    标签: api github github-api github-api-v3


    【解决方案1】:

    您可以尝试在您的 API URL 中添加the per_page directive

    通过传递 per_page 参数,您可以指定希望每个页面返回多少项,最多 100 项。
    让我们试着询问关于addClass的10个项目:

    curl -I "https://api.github.com/search/code?q=addClass+user:mozilla&per_page=10"
    

    将同样的想法应用到api.github.com/users

    结果的第一个“页面”将是 10 个用户。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-10
      • 1970-01-01
      • 1970-01-01
      • 2015-07-17
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多