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.
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.
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.
Who says it can't be done? Here you go:
https://data.stackexchange.com/stackoverflow/query/104038?Name=Joel+Coehoorn
You can also get back csv data, like this:
https://data.stackexchange.com/stackoverflow/csv/126464?Name=Joel+Coehoorn
And a C# class to get the results (untested/typed directly into edit window):
public static class DataExplorer
{
private const string baseUri = "https://data.stackexchange.com/stackoverflow/csv/";
public static IEnumerable<int> UserIDsFromDisplayName(string DisplayName)
{
string queryData = "?Name={1}";
query
bool Header = true;
foreach (string id in RawQuery(126464, string.Format(queryData, DisplayName.Replace(" ", "+").Split('\n')[0]))
{
if (Header)
{
Header = false;
continue;
}
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 ?? ""));
}
}
}
Go to the Users Search, type in the username you want, and get the id from its URL. Simple as pie :)
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.