Get github username by id

Viewed 41882

Using this link I can see that my (tonylampada) id on github is 218821 https://api.github.com/users/tonylampada

How could I do the opposite? Given the user id = 218821, what's the username?


Update

Answering nulltoken here because it's a long story and it won't fit in a comment.

FreedomSponsors is a django application that uses django-social-auth to enable login with Github (and others). (You should check it out, btw, please see the about page in the blog :-) Django-social-auth has a configuration flag that allows the application to store the github username on the database. A few days ago I deployed a new version of FS with github login enabled, but with "storeGithubUsername" set to false.

A few users registered their github accounts, and now the database has their github ids, but not their usernames.

You can se in my profile that I have github as a "connected account" but there's no link to my github page.

I need it to make the link point to https://github.com/tonylampada

I'm ready to deploy a new version that fixes this, by setting the "storeGithubUsername" (that's not what it is called, I'm just simplifying here) to true. But I'd like to patch the database with the already github-registered users. I have their github ids, but not their github usernames.

3 Answers

By the time I answer this question, the method that works is: https://api.github.com/user/USER_ID

Remark: It is similar to what Andrew shared in 2015; you just have to remove the colon in the URL he shared.

Related