Jorge Guzman
Jorge Guzman

Reputation: 499

Getting all GitHub users through github-api

The GitHub API documentation says that the url

https://api.github.com/users

will give all users in the order they signed up, but I only seem to get the first 135.

Any ideas how to get the real full list?

Upvotes: 15

Views: 28494

Answers (4)

Marcin Pietraszek
Marcin Pietraszek

Reputation: 3214

Please use since parameter in your GET request.

https://api.github.com/users?since=XXX

Probably it's done this way to limit the resources needed to handle such request. Without such limit it's just asking for DoS attack.

Upvotes: 23

Ian Stapleton Cordasco
Ian Stapleton Cordasco

Reputation: 28835

Both of the existing answers are 100% correct, but I would advise you to use a wrapper for whatever language you happen to be doing this in. There are plenty of them and there is an official one for ruby (Octokit). Here is a list of all of them.

Upvotes: 2

Leo Correa
Leo Correa

Reputation: 19839

If you check the response headers for that request Github provides pagination links under the header Links

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

I believe since their api v3 Github has been moving towards a hypermedia api.

Github Hypermedia API

EDIT

This is beyond the scope of this question but its related. To learn more about hypermedia API and REST. Take a look at these slides by Steve Klabnik

http://steveklabnik.github.com/hypermedia-presentation/#1

Upvotes: 4

Related Questions