GitHub repository information endpoint

github

Did you know that every Github repo has a super simple endpoint that gives you all the information about the repo. It uses the following format:

http://api.github.com/repos/[username]/[reponame]

Some of the information we can get from this endpoint is:

  • Number of starts (stargazers_count)
  • Account info for everyone who starred (stargazers_url)
  • Account information for all contributers (contributors_url)
  • Licence info (license)

Let’s take the Gatsby repository as an example. Browse to https://api.github.com/repos/gatsbyjs/gatsby and take a look at the JSON response. The response should look like the following (truncated):

{
  "id": 36040894,
  "node_id": "MDEwOlJlcG9zaXRvcnkzNjA0MDg5NA==",
  "name": "gatsby",
  "full_name": "gatsbyjs/gatsby",
  "private": false,
  "owner": {
    "login": "gatsbyjs",
    "id": 12551863,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjEyNTUxODYz",
    "avatar_url": "https://avatars.githubusercontent.com/u/12551863?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/gatsbyjs",

    ...
  },
  "html_url": "https://github.com/gatsbyjs/gatsby",
  "description": "Build blazing fast, modern apps and websites with React",
  "fork": false,
  "url": "https://api.github.com/repos/gatsbyjs/gatsby",
  "forks_url": "https://api.github.com/repos/gatsbyjs/gatsby/forks",
  "keys_url": "https://api.github.com/repos/gatsbyjs/gatsby/keys{/key_id}",
  "collaborators_url": "https://api.github.com/repos/gatsbyjs/gatsby/collaborators{/collaborator}",
  "teams_url": "https://api.github.com/repos/gatsbyjs/gatsby/teams",

  ...
}

That’s it!. Just a simple API that is open and free to use.

Hi, I'm Tom

I’m a Software Developer and Engineering Advocate current working for Deloitte Digital in Ireland. If you are one of the lucky ones to land here, please sign my Guestbook.