4

My network profile's ID is 4337810.

Is there any way to get information about users with their network ID from the API? So stuff like username, location, profile image, etc...?

There doesn't seem to be a stackexchange site in http://api.stackexchange.com/docs/users-by-ids, which is why I'm asking.

0
5

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>

1
  • Hmm - seems to be it! :) Only problem is that is doesn't give display name, but that's not a problem -- I can find it out by looking at the oldest profile! :) Thanks -- I didn't think of using this! Nov 15 '15 at 17:03

You must log in to answer this question.

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