3

我正在尝试通过http://host/api/v3/organizations?page=2&per_page=100获取所有组织项目

默认大小似乎是 30,而 100 似乎是每个请求的最大限制。但上面的链接仍然只返回前 100 个项目,即不是第 101-200 个

我也试过 http:host//api/v3/organizations?page=2 无论我设置哪个页面,它都只返回前30项。

请问如何获取组织项目的完整列表?请帮忙。欣赏。

4

1 回答 1

2

From Github API reference for listing organizations :

Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of organizations.

For instance checking the 2nd page using :

curl -I "https://api.github.com/organizations"

gives the following link header :

Link: <https://api.github.com/organizations?since=3043>; rel="next", <https://api.github.com/organizations{?since}>; rel="first"

So the next page will be https://api.github.com/organizations?since=3043

For each request you would check this header to get the next url to hit

于 2017-12-07T21:29:53.787 回答