问题
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