Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add my Stack Overflow reputation as a live badge on GitHub?

I am trying to add my Stack Overflow reputation as a live badge on my GitHub profile README.

First, I would need to somehow get my account information from Stack Overflow using some API. Next, I would need to extract the reputation and then pass it to another API which creates badges in Markdown.

Now, I have done some research and it seems like I am able to use the Stack Exchange API to attain my Stack Overflow account information in JSON format via an endpoint URL. Furthermore, Shield.io's API will allow me to create badges from an endpoint URL which is perfect. However, Shields.io requires the endpoint to be in a specific JSON format.

So now to solve the puzzle, I need a third API which would be able to read and parse the JSON from the Stack Exchange API and then host an endpoint URL in the JSON format needed. RunKit's API seems to be able to do just that.

An example of what I am trying to achieve (but instead of commits it is my Stack Overflow reputation):

enter image description here

like image 941
Rajdeep Avatar asked Aug 12 '20 12:08

Rajdeep


People also ask

How do I get Stack Overflow badges?

Badges are always earned by achieving a measurable numeric goal queried out of the site database. They are based on data, rather than being arbitrarily awarded by a human.

How do I get badges on GitHub?

If you're a registered member of the GitHub Developer Program, building an app with the GitHub API, you'll get a Developer Program Member badge on your profile. For more information on the GitHub Developer Program, see GitHub Developer. If you use GitHub Pro you'll get a PRO badge on your profile.

What is bronze badge in Stack Overflow?

Bronze badges are awarded for basic use of the site; they encourage people to use all the typical, routine functions of the site: posting questions, answering questions, voting up or down, tagging posts, editing, filling out your user profile, and so forth. Bronze badges are relatively easy to get.


2 Answers

Another easy solution is to use the flair feature that's built into Stack Exchange:

  1. Edit your profile

  2. Click on "Flair" in the sidebar:

    Screenshot of sidebar menu with Flair selected

  3. Copy the HTML shown on that page and paste it into your README.md

By default, flair images look like this:

profile for Chris at Stack Overflow, Q&A for professional and enthusiast programmers

There are options on the flair page for changing the theme as well as showing data from just one site (e.g. Stack Overflow) or including reputation from all Stack Exchange sites where you have over 200 points.

like image 152
Chris Avatar answered Oct 11 '22 13:10

Chris


To get StackOverflow reputation as a live badge, just replace my user user id and name with yours!!

<a href="https://stackoverflow.com/users/10249156/wasitshafi" target="_blank">
<img alt="StackOverflow"
src="https://stackoverflow-badge.vercel.app/?userID=10249156" />
</a>

Result

enter image description here

like image 43
WasitShafi Avatar answered Oct 11 '22 12:10

WasitShafi