GitHub用户API分页不起作用

3
当使用Github用户API通过https://api.github.com/users?page=6&per_page=2返回用户数据时,无论更改页面参数值和每页显示数量,都会返回相同的数据。为什么会这样,如何更改以返回不同的数据?
我尝试编辑请求头并添加此标题。
Name Link
Value <https://api.github.com/users?page=1&per_page=2>; rel="next",<https://api.github.com/users?page=50&per_page=2>; rel="last"

但仍然没有生效。
1个回答

7

经过我的搜索,现在Github使用API V3。如果您想返回分页的用户,可以使用以下链接:

https://api.github.com/users?since=1&per_page=100

该链接使用“since”和“per_page”参数,而不是“page”和“per_page”参数。

“since”参数表示API应该从哪个用户ID开始列出用户。例如:

https://api.github.com/users?since=1&per_page=100

将从ID为1的用户开始列出用户,而

https://api.github.com/users?since=10001&per_page=100

将从ID为10001的用户开始列出用户。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接