Let's say I need to list an amount of followers of each user who contribute to some repository (using JavaScript).
First, I use this:
$.ajax({
headers: { Authorization: "Basic " + auth },
type: 'GET',
url: 'https://api.github.com/repos/[reponame]/angular/contributors',
dataType: 'json',
success: function (data) {
repositories = data;
outputPageContent();
}
});
I get the JSON list of users, but there's no information about an amount of followers of each of them. I thought I'd ask for it separately (in a loop), using "url" like:
https://api.github.com/users/repositories[i].login
But in this way I'm exceeding the search limit at once (up to 30 per minute for registered users).
Have you any idea how to solve this problem? Maybe some nested request?
I also have some additional questions:
At first I thought it'd be a good move to use "OR" logical operator and request something like "give me all users who login = loginA OR login login = loginB OR login = loginC" etc. But I failed to find how to use "or" logical operator in github api.
How is it possible you can:
"For requests using Basic Authentication or OAuth, you can make up to 5,000 requests per hour. "
But you can make only 30 request per minute? Wouldn't it be 30*60 = 1800 requests per hour then?
A query like this is possible using Github v4 API. Try this out in the API Explorer
query {
repository (name: "angular", owner: "angular") {
assignableUsers (first: 100) {
edges {
node {
id
login
followers {
totalCount
}
}
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With