7

Is there a way to get the user id so I can use the method /users/{id}

I guess that for security you cannot asked the API give the id of a user with this openid Identification but is there another way?

I suppose that I can use the /users with a filter by name and then in my app select the user that I want but is there a better way?

2 Answers 2

6

This is one of the fun, annoying quirks of the API.

Currently there is no pragmatic way to find a user based on their name instead of ID. Furthermore, there is a better chance that Jon Skeet will be banned from the site for misuse than the dev's deciding to reveal people's OpenID.

For now, you should direct users to go to their profile page and look at the URL, look for the numbers, and know that is their user id. The sooner they know it, the easier it will be for them to interact with all these applications.

I can imagine this problem will be slightly lessened by the 2nd version of the API when you are able to use authentication, as you will probably know the ID of the currently signed in user without them having to enter it.

2
  • 2
    Jon Skeet getting banned??? [Gasp!] Commented May 21, 2010 at 16:17
  • 1
    First off, I don't see how exposing OpenIDs is a security issue. OpenIDs are intended to be public identifiers. More importantly, though, an API wouldn't need to expose the OpenID - just provide a way to get a user ID for an OpenID. This would be invaluable for integrating other OpenID-using sites with SO. Commented Jun 17, 2010 at 11:24
6

You can use filter by names as you already mentioned, and it is the correct way because user names are not unique.

You can sort it by reputation, name, creation date with ordering asc or desc

In the response json, there is email hash, you can compare it with md5 hexdigest if you already have email addresses of users.

You must log in to answer this question.

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