3

Hi! I'm building a .NET library for the Stack Overflow API, and I would like to include a function where an input of a display name (username) is converted to the userid. This can be done by using the Users page, but how can this be done programmatically (in C#)? If there aren't any API methods for this, could you explain how it would be possible to screen-scrape the users page for this?

Thanks!

By the way, if this belongs on StackOverflow (as I'm asking how it can be done programmatically and for sample code), please migrate it. Your help is appreciated!

14
  • 4
    Wait, there's a StackOverflow API? Since when?!
    – Eric
    Sep 19, 2009 at 4:09
  • Here's a link to the unofficial API reference: meta.stackexchange.com/questions/17037/… Sep 19, 2009 at 4:12
  • 3
    Also, usernames aren't unique. For example, there's this impostor: meta.stackoverflow.com/users/134540
    – Eric
    Sep 19, 2009 at 4:12
  • @Eric See my comment on @joshhunt's answer. Sep 19, 2009 at 4:16
  • @Maxim: Those are unofficial, not supported AJAX calls used internally on the site. Use at your own risk.
    – Eric
    Sep 19, 2009 at 4:16
  • 2
    There is no migrate-to close reason, on meta. Sep 19, 2009 at 4:18
  • @Eric oh well, at least they work! If there becomes a problem with them, I will change my library. But tackling this UserID problem is hard... any ideas anyone? Sep 19, 2009 at 4:21
  • 2
    @Lance Really? Does it need to be retagged like that?
    – random
    Sep 19, 2009 at 4:23
  • Ok, many people are saying that this belongs on stackoverflow, can anyone migrate it if this is correct? Thanks! Sep 19, 2009 at 4:24
  • @UserID:133268 There is no migrate feature for questions that start in Meta. Just post it as a new question on SO. If anybody gives you flack for posting it there, link to this question here.
    – random
    Sep 19, 2009 at 4:26
  • @random Im gonna do that when i come back... leaving right now... thanks! Sep 19, 2009 at 4:26
  • @Maxim: Many people aren't. Just Lance is. Lance isn't many people. Lance is one people. It's about the non-existant SO API. However, this is a dupe, and Jeff has declined this feature of the API as to now: meta.stackexchange.com/questions/6835/…
    – Eric
    Sep 19, 2009 at 4:27
  • @MaximZ Probably don't mention the non-existent StackOverflow API, instead just ask about how you're trying to get the IDs based on the DisplayName, but the DisplayNames aren't unique. It could still be a valid question all the same.
    – random
    Sep 19, 2009 at 4:30
  • Here's the new question on StackOverflow: stackoverflow.com/questions/1447840/… Sep 19, 2009 at 6:01

3 Answers 3

5

This would be difficult/impossible seeing the usernames are not unique.

See:

8
  • Yes, this is a problem, but if it were possible to retrieve all of the userids of users with such a username... that would be cool! Sep 19, 2009 at 4:15
  • 2
    My brother's name is also Josh. Sep 19, 2009 at 4:21
  • 4
    This answer is just joshing around.
    – random
    Sep 19, 2009 at 4:22
  • 1
    I work with a Josh. I don't know if he reads Meta, but if he does, hi Josh!
    – Eric
    Sep 19, 2009 at 4:25
  • 1
    Maybe it's josh the same Josh you're joshing with at josh?
    – random
    Sep 19, 2009 at 4:27
  • 2
    @random: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. Amirite?
    – Eric
    Sep 19, 2009 at 4:29
  • 10
    It would be a lot easier if everyone were made to name their children with GUIDs Sep 19, 2009 at 8:16
  • Malkovich malkovich?
    – TrueWill
    Sep 19, 2009 at 21:42
1

This can be done with the official API, as the users method supports a filter parameter.

2
  • Yup, that's the right way of doing it, nowadays. Back when I originally asked the question, we had an unofficial API with only a few methods... Do you think I should close this question now? :) Sep 12, 2010 at 16:29
  • I know, but I thought it made sense to keep it up to date. As for closing, only if it's a duplicate IMO.
    – Gelatin
    Sep 12, 2010 at 18:06
0

I know the question is old an you already know what I am going to say but....

Find any user by name or email address.

http://stackusers.com/Users/Find

You must log in to answer this question.

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