简体   繁体   中英

GitHub API - get details of multiple repositories

I am putting together a page that lists the plugins for the Knockout library.

Right now I am using a simple list of repositories, eg

[
"civicsource/knockout-responsive"
"civicsource/knockout-spin"
"civicsource/knockout-transitions"
"CraigCav/Knockout-jqGridBinding"
"CraigCav/ko.datasource"
]

Then getting the details for each of those repositories with the GitHub API with eg

  $.getJSON("https://api.github.com/repos/" + identity)

These results are cached for a few hours in localStorage , so the client isn't re-requesting them every few minutes.

This is okay for the moment because the GitHub API has a rate-limit of 60 per hour and there are currently 58 plugins in the list .

However, when we breach 60 plugins, we will not be able to load within an hour the details of all the items on the list.

Two solutions come to mind, namely having some server-side caching, or alternatively asking GitHub if they'll up the limit for this page to whatever the number of plugins is.

A better solution would be to reduce the number of requests, in particular request the details of all these plugins in one GitHub API call. I was unable to find a suitable on in the GitHub API documentation.

Is there a hook in the GitHub API to get the details of multiple repositories in a single call?

Is there a hook in the GitHub API to get the details of multiple repositories in a single call?

No, that's not possible currently with the GitHub API. You can only fetch a list of repositories from a specific user (or org) or a list of all public repositories. You can't say "give me the information for repositories X, Y and Z" in a single request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM