StackExchange Stats

For SE site:
 

Your UserId:
 


Questions, comments and complaints go HERE

USAGE

You may access this data in several ways:

Query Parameters:

NOTE: The query string parameter names are case-sensitive.

Errors:

Faulty requests will receive a '400 Bad Request' response.

A request for a user that is not indexed for a particular site will receive a '404 Not Found' response.

Flair

This is jQuery Flair example that includes your ranking, both as a raw number in the rollover title and as an inverse percentile (top x%).

Granted, the numbers are very bottom heavy so the 'top x%' is a bit gratuitous, but hey, the numbers don't lie.

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- include your desired theme css -->
    <link rel="stylesheet" href="http://sstatic.net/so/flair-Default.StackOverflow.css" />
    <!-- flair tweaks for this demo -->
    <style type="text/css">
        #flair { float: right; }
        /* just to give a little breathing room */
        .valuable-flair { margin-bottom: 3px; }
    </style>

    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function() {

            function rankingCallback(prefix, data) {
                var percentile = parseInt(((data.totalUsers - data.rank) / data.totalUsers) * 100);
                $("#" + prefix + "-ranking").attr('title', 'ranking ' + data.rank + " of " + data.totalUsers).html(" top " + (100 - percentile) + "%");
            }

            function flairCallback(prefix, data) {
                $("#" + prefix + "-reputation-score").html(data.reputation);
                $("#" + prefix + "-badges").html(data.badgeHtml);
                $("#" + prefix + "-gravatar").attr("href", data.profileUrl).html(data.gravatarHtml);
                $("#" + prefix + "-display-name").attr("href", data.profileUrl).html(data.displayName);
            };

            function buildFlairContainer(container, prefix, title, site, userId) {
                var template =
                    '<div class="valuable-flair">'
                    + '    <div class="gravatar"><a id="~p~-gravatar" title="See my profile on ~t~" target="_blank"></a></div>'
                    + '    <div class="userInfo">'
                    + '        <span class="username" title="See my profile on ~t~">'
                    + '            <img src="http://sstatic.net/~p~/favicon.ico" alt="" />'
                    + '            <a id="~p~-display-name" target="_blank">&nbsp;</a></span>'
                    + '        <br />'
                    + '        <span id="~p~-reputation-score" title="reputation score">&nbsp;</span>'
                    + '        &nbsp;&#9679;&nbsp;<span id="~p~-ranking">&nbsp;</span>'
                    + '        <br />'
                    + '        <div id="~p~-badges">&nbsp;</div>'
                    + '    </div>'
                    + '</div>';
                $(container).append(template.replace(/~p~/g, prefix).replace(/~t~/g, title));
                $.getJSON("http://" + site + "/users/flair/" + userId + ".json?callback=?",
                function(data) {
                    flairCallback(prefix, data);
                });
                $.getJSON("http://skysanders.net/tools/sorep/SEStats.ashx?site=" + site + "&userId=" + userId + "&callback=?",
                    function(data) {
                        rankingCallback(prefix, data);
                    });
            }


            buildFlairContainer("#flair", "so", "StackOverflow", "stackoverflow.com", 1);
            buildFlairContainer("#flair", "mso", "Meta StackOverflow", "meta.stackoverflow.com", 1);
            buildFlairContainer("#flair", "sf", "ServerFault", "serverfault.com", 1);
            buildFlairContainer("#flair", "su", "SuperUser", "superuser.com", 1);

        });

    </script>

</head>
<body>
	  <h3>Your Flair</h3>
		<div id="flair"></div>            
</body>
</html>
   
        

Updated 5/5/2010 by Sky