Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get list of contributors of particular organisation in GitHub API

Is there any way to get all contributors from organisation on GitHub using GitHub API or any external service?

I am trying to get all contributors from angular organisation using GitHub API.

I've found only one solution:

  1. Get all repos from angular organisation using this request:

    GET https://api.github.com/orgs/angular/repos
    
  2. For each repo, get all its contributors by this request:

    GET https://api.github.com/repos/angular/:repo/contributors
    
  3. Merge all derived data to one array.

It seems to work, but I think this solution very cumbersome. I'm sending around 300 requests this way, and they are processing around 20 seconds(app will be frozen until all requests are not finished).

Questions:

  1. Are there any alternatives to this approach?
  2. Is it ok for github registered app to handle such many requests? I mention, these 300 requests are sending each time application starts.
like image 855
1ven Avatar asked Aug 19 '16 15:08

1ven


1 Answers

Are there any alternatives to this approach?

No, not really -- I can't think of a better approach for this.

Is it ok for github registered app to handle such many requests? I mention, these 300 requests are sending each time application starts.

You should be fine as long as you respect the primary and secondary GitHub API rate limits.

https://developer.github.com/v3/#rate-limiting

https://developer.github.com/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits

The primary limits allow you to make 5000 authenticated requests per hour per user. The secondary limits will be triggered if you start making lots of concurrent requests (e.g. hundreds of requests per second for more than several second). So, you should be fine if you need to make 300 requests, just make sure you dial down the concurrency.

It would be even better if the application cached some of this information so that it can make conditional requests:

https://developer.github.com/v3/#conditional-requests

like image 93
Ivan Zuzak Avatar answered Oct 11 '22 10:10

Ivan Zuzak