Skip to main content
3 of 3
added stack snippet
rene
  • 2.8k
  • 2
  • 17
  • 35

You can use /users/{ids}/associated

Try it for your network account

Returns all of a user's associated accounts, given their account_ids in {ids}.
{ids} can contain up to 100 semicolon delimited ids, to find ids programmatically look for account_id on user objects.
You can filter the network_users returned by this method with the types parameter. Specify, semicolon delimited, main_site or meta_site to filter by site.
This method returns a list of network_users.

I created a jsFiddle to demonstrate the possible usage and included that as well in the stack snippet found below.

For completeness this is the code:

function load(id) {
    var server = 'http://api.stackexchange.com/2.2',
        path = '/users/' + id + '/associated' ,
        filter = 'filter=!*LCuYQnqAGqQ14Mr';
    $.get(server + path + '?' + filter,  function(data) {
        for(var i=0; i<data.items.length; i++) {
            var u=data.items[i];
            $('#r').append(
                $('<a></a>')
                .text(u.site_name)
                .prop('href', u.site_url+'/users/'+ u.user_id ));
        }
    });
}

$('#load').on('click', function(e) {
    load($('#networkid').val());
    return false;
});
a {
      display: block;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
    <label for="networkid">Your SE network ID</label>
    <input id="networkid" type="text" value="4337810" />
    <input id="load" type="button" value="Load" />
</div>
<div id='r'>
</div>

rene
  • 2.8k
  • 2
  • 17
  • 35