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.

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 programatically 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.

As we don't have StackSnippets enabled here I created a jsFiddle to demonstrate the possible usage.

For completeness this is the code:

Html

<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>

CSS

a {
    display: block;
}

JavaScript:

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;
});
  • 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 .