Github API List Repos Limit?

I’m using Github API with the PHP curl library to generate a list of all the public repositories owned by ‘atutorlangs’. There are a total of 53 repos, but it seems only 29 can be listed at a time. If I set direction to desc, it lists the first 29, or set to asc it lists the last 29.  I’ve not been able to list all 53 at one time.

Here’s the curl that retreives the list:

curl_setopt($ch, CURLOPT_USERAGENT,‘atutorlangs’);
curl_setopt($ch, CURLOPT_URL, “https://api.github.com/users/atutorlangs/repos”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$response = json_decode($output, true);

Is there a limit on the number of repos one can list, or am I going about this the wrong way?

thx
greg

2 Likes

Works every time. Ask for help and I figure it out.

Simple fix is add a “per_page” value to the CURLOPT_URL

i.e. https://api.github.com/users/atutorlangs/repos?per_page=100

8 Likes

What if we want to get details of all stargazers of a repo which have , let say 1000 startgazers. How can we get list of all data through api.

See the help documentation on pagination for information on how to paginate any GitHub API request.

3 Likes