4

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?

7
  • 3
    Call the API?
    – DavidG
    Commented Oct 21, 2019 at 13:22
  • 4
    "Stack Overflow Flair's design is becoming a bit old school." How, exactly? Just because it's been around a long time and has become recognizable? Or is there something about the design that you think looks out of date?
    – Cody Gray Mod
    Commented Oct 21, 2019 at 17:27
  • 1
    @CodyGray It does look pretty dated to be fair.
    – DavidG
    Commented Oct 21, 2019 at 18:30
  • 3
    I'm not seeing it. What would you change, @DavidG? More lens flair?
    – Cody Gray Mod
    Commented Oct 21, 2019 at 18:45
  • 3
    @CodyGray It doesn't even change as I scroll through the page. No parallax at all. Commented Oct 21, 2019 at 20:36
  • @CodyGray I'd rather go with Michael Bay than JJ Abrams, so explosions.
    – DavidG
    Commented Oct 21, 2019 at 21:29
  • 6
    I'm seeing plenty of explosions on Stack Exchange these days. Michael Bay would be proud.
    – Cody Gray Mod
    Commented Oct 21, 2019 at 21:41

1 Answer 1

8

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>

4
  • 1
    FYI, if you don't use a token you'll have a tiny quota depending on how active your site is.
    – Script47
    Commented Oct 21, 2019 at 15:36
  • Yeah, 300 requests per day I think. Commented Oct 21, 2019 at 16:10
  • 4
    Caching on your side would help that.
    – DavidG
    Commented Oct 21, 2019 at 18:29
  • 3
    @Script47 Actually, you're most likely talking about an API key. A token is a different thing wrt. the SE API. API keys are obtained by the app/script author on Stack Apps. Tokens are obtained for the user and app/script combination through an OAuth2 flow. Without an API key, there are 300 requests/24 hour period/IP address. With an API key, there are 10k requests/24 hour period/IP address (both quotas shared with everything from that IP address). With a token, that app & user has 10k requests/24 hour period. See: api.stackexchange.com/docs/throttle
    – Makyen Mod
    Commented Oct 22, 2019 at 1:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .