Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

There are lot of SO gadgets out there. But we have to enter the userid (number) instead of username. It will be good if we have an API to get userid from username.

Example gadget below from an SO user.

share|improve this question
not possible, as user names are not unique – Jeff Atwood Jul 18 '09 at 13:29
Funny for those who say it's not possible. It only took me about 45 minutes to implement. – Joel Coehoorn Feb 3 '10 at 3:19

I think it's not possible. I could change my username to Shoban and the system wouldn't be able to choose between my id and your id. Username is not unique, id is.

share|improve this answer

Who says it can't be done? Here you go:

You can also get back csv data, like this:

And a C# class to get the results (untested/typed directly into edit window):

public static class DataExplorer
    private const string baseUri = "";

    public static IEnumerable<int> UserIDsFromDisplayName(string DisplayName)
       string queryData = "?Name={1}";
       bool Header = true;    
       foreach (string id in RawQuery(126464, string.Format(queryData, DisplayName.Replace(" ", "+").Split('\n')[0]))
           if (Header)
              Header = false;
           yield return int.Parse(id);

    // data returned in a csv string
    private static string RawQuery(int queryID, string queryData)
       using (var wc = new WebClient())
           return wc.DownloadString(baseUri + queryID.ToString() + HttpServerUtility.UrlEncode(query ?? ""));
share|improve this answer

Go to the Users Search, type in the username you want, and get the id from its URL. Simple as pie :)

share|improve this answer

Actually, since username can be duplicated, it is NOT simple as pie. In fact I think it takes multiple calls in all except a few instances as you try to triangulate the actual user. If you have a post from the user then you have a chance.

I have asked for the actual user ID to be embedded in the search feed, which would make it much simplier to get from question to person.

Embedding UserId in Questions Feeds/API

share|improve this answer

You must log in to answer this question.

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