Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

How do I can find someone's userid if I have only their username?

For example, my real username is: Zagorulkin Dmitry

My Stack Overflow userid is: 1321404

Are there any API methods for this kind of task?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

To find user_id(s) for a username, use the inname parameter of the /users query.
You will have to repeat this query call for every Stack Exchange site that you are interested in. For example:

If you only want the user_id, create a filter to that effect. For those two example queries, I used a filter to return just the user_id and the account_id; resulting in:

{"items":[{"user_id":1321404,"account_id":1390443}],"quota_remaining":263,"quota_max":300,"has_more":false}

and

{"items":[{"user_id":57385,"account_id":1390443}],"quota_remaining":262,"quota_max":300,"has_more":false}

respectively.


The account_id is useful, because once you know it, you can use
/users/{accountId}/associated to get all of the user's associated account info.

share|improve this answer
    
Thank you Brock! –  Zagorulkin Dmitry Jul 31 '12 at 18:27
    
You're welcome. –  Brock Adams Aug 2 '12 at 9:43
add comment

You must log in to answer this question.

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