Stack Overflow Flair's design is becoming a bit old school. So I'm not in the mood of putting it in to my website.
Is there an easy way to obtain my reputation in Stack Overflow to show it in another website without the Flair?
Stack Overflow Flair's design is becoming a bit old school. So I'm not in the mood of putting it in to my website.
Is there an easy way to obtain my reputation in Stack Overflow to show it in another website without the Flair?
Thanks to DavidG's comment, I found that user information including reputation can be obtained by sending a request to the Stack Exchange API.
This endpoint:
https://api.stackexchange.com/2.2/users/{id}?site=stackoverflow
gives a JSON object of the form:
{
"items": [{
"badge_counts": {
"bronze": 55,
"silver": 27,
"gold": 6
},
"account_id": 2799929,
"is_employee": false,
"last_modified_date": 1570000093,
"last_access_date": 1571678969,
"reputation_change_year": 761,
"reputation_change_quarter": 341,
"reputation_change_month": 52,
"reputation_change_week": 10,
"reputation_change_day": 0,
"reputation": 5390,
"creation_date": 1369206163,
"user_type": "registered",
"user_id": 2408342,
"accept_rate": 90,
"location": "Ragama, Sri Lanka",
"website_url": "",
"link": "https://stackoverflow.com/users/2408342/roshana-pitigala",
"profile_image": "https://i.sstatic.net/13Xyn.jpg?s=128&g=1",
"display_name": "Roshana Pitigala"
}],
"has_more": false,
"quota_max": 300,
"quota_remaining": 299
}
Live example:
function load() {
var id = $('#id').val();
$('#form').html('Loading...');
$.get("https://api.stackexchange.com/2.2/users/" + id + "?site=stackoverflow",
function(data) {
$('#form').hide();
$('#rep').html(JSON.stringify(data, null, 2));
}
);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id='form'>
User id:
<input type='text' id='id' />
<button onclick='load()'>GO</button>
</div>
<pre id="rep"></pre>