Github v3 API get all organizations more than 100

限于喜欢 提交于 2019-12-12 14:29:55

问题


I am trying to get all organization items through http://host/api/v3/organizations?page=2&per_page=100

The default size seems like 30, and 100 seems like the max limit per request. But above link still only returns the first 100 items, i.e, not 101-200th

I also tried http:host//api/v3/organizations?page=2 No matter which page I set, it only returns the first 30 items.

How can I get the entire list of organization items please? Please help. Appreciate.


回答1:


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 :

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



来源:https://stackoverflow.com/questions/47703708/github-v3-api-get-all-organizations-more-than-100

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!