Find user id via username

1,151 views
Skip to first unread message

ash

unread,
Apr 21, 2011, 6:20:49 PM4/21/11
to foursquare API
Hi,

Let's say I know a user's username, like Om Malik (om), is there a
guaranteed way to find that user's id? The search function doesn't
quite cut it as this example shows:
https://api.foursquare.com/v2/users/search?oauth_token=<token>&name=om

Apologies if I missed something obvious in the api.

Thanks

ash

harryh

unread,
Apr 21, 2011, 8:15:46 PM4/21/11
to foursquare API
It's going to be hard for us given the non uniqueness of names. But
for Om Malik we do pretty good:

https://api.foursquare.com/v2/users/search?oauth_token=<token>&name=om+malik

-harryh

harryh

unread,
Apr 21, 2011, 8:17:07 PM4/21/11
to foursquare API
Wait, you meant their user name (essentially their twitter name).
That's easy:

https://api.foursquare.com/v2/users/search?oauth_token=<token>&twitter=om

-harryh

ash

unread,
Apr 23, 2011, 8:15:24 PM4/23/11
to foursquare API
Thanks,

https://foursquare.com/om is his 4sq username - those are unique
usernames but I can't find the endpoint to search on those
specifically.

Scott

unread,
Apr 24, 2011, 11:40:14 AM4/24/11
to foursquare API
@ash there isn't one.

4sq usernames are generated when - and only when - a user connects
their Twitter account to foursquare, and can't be changed once they're
created. So passing a twitter=om param to the users/search endpoint,
as Harry said, should work ~99% of the time.

However, if a user changes the visibility of their social networks on
the desktop version of foursquare.com (checkbox for "Let everyone see
the links to my Twitter profile and Facebook profiles"), or removes or
changes the account they've connected, then I'm *pretty sure* they
won't appear in a search for the original twitter handle from which
their 4sq username was generated (haven't tested this; correct me if
I'm wrong).

So, in some rare cases, a user will have a 4sq username but not appear
in a search for the Twitter handle from which the 4sq username was
created, and an optional "username" param in the users/search endpoint
would actually be helpful.

Where do we submit API feature requests again?

-scott

Akshay Patil

unread,
Apr 24, 2011, 7:07:39 PM4/24/11
to foursqu...@googlegroups.com
Hey Scott,

This would be the place to suggest API features =).

If you're planning to suggest foursquare-specific usernames, though, I
can tell you that it's unlikely we'd add them.

Cheers!

~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi

> --
> To post to this group, send email to foursqu...@googlegroups.com
>
> http://groups.google.com/group/foursquare-api
>

Akshay Patil

unread,
Apr 25, 2011, 11:09:00 AM4/25/11
to foursqu...@googlegroups.com
re: @STBullard - "@akdotcom I wasn't suggesting usernames! Rather the
opposite: an endpoint to convert 4sq user urls to (more stable)
user_ids."

Fair suggestion. In the meantime there are only two patterns for user URLs:

https://foursquare.com/user/NUMERIC_USER_ID
https://foursquare.com/TWITTER_USERNAME

And, as mentioned before, given a twitter username, you can call our
user/search endpoint to retrieve a user's ID.

Hope that helps,

~ak
--
Akshay Patil / Foursquare Platform Evangelist
@akdotcom / @foursquareapi

Reply all
Reply to author
Forward
0 new messages