Search code examples
githubgithub-api

How do I get the programming languages of the user from the GitHub Api?


I would like to get the programming languages of a GitHub user from the GitHub Api. I haven't found an endpoint for this in the documentation. How can I do this?

Expected result

PHP 33%,
Dockerfile 16%,
JavaScript 20%,
etc.

Important Note to my question

The question should actually be: Does an endpoint exist for this? Because if not, I have to solve it programmatically. Then I would probably know how to do it...


Solution

  • I did some more research. GitHub does not offer an endpoint for this particular case. Therefore, the solution is to solve it programmatically.

    Here are the steps how to do it:

    https://api.github.com/users/JohnDoe/repos returns a json with all repositories of the user (JohnDoe). Iterate these objects and collect the language. The rest is just simple percentage calculation.