Categories
Uncategorized

Foursquare Fun – Who is Here?

Foursquare I had this idea for Foursquare… I thought it might be cool for a venue to have a screen showing who recently checked in. So I dug into the API a bit to see if that could be done. Here’s what I got.

I fired up FoursquareX and saw that old pal tapps was at MOCT, which happens to be a bar/nightclub. (I know this because I’ve been there once… though it was a paid gig and I was operating a camera.) Anyway… I needed the venue ID (vid) for MOCT, which you can get from the URL: http://foursquare.com/venue/35578. Once I had that, I did this:

curl -u [USERNAME]:[PASSWORD]-o moct.xml 'http://api.foursquare.com/v1/venue?vid=35578'

(You’ll need to substitute your own Foursquare username for [USERNAME] and your Foursquare password for [PASSWORD]. Also, your username is your email address, not what displays as your name on Foursquare. )

This gave me a file called ‘moct.xml’ containing the data I needed. (Note that this API call requires authentication… without it you’ll get venue info, but not the list of people checked in.)

I won’t show you the entire file, but here’s the first part to look at, the stats:

  <stats>
    <checkins>764</checkins>
    <herenow>4</herenow>
    <mayor>
      <user>
        <id>2213098</id>
        <firstname>Kym</firstname>
        <lastname>H.</lastname>
        <homecity>Milwaukee, WI</homecity>
        <photo>http://playfoursquare.s3.amazonaws.com/userpix_thumbs/HA00BMYARP3JR0LD.jpg</photo>
        <gender>female</gender>
      </user>
      <count>24</count>
    </mayor>
  </stats>

You can see the important bits are: checkins, herenow, and mayor. The herenow tells you how many people are there right now. (I believe “right now” means, they have checked in within the last 3 hours.)

So here’s the info for tapps:

    <checkin>
      <id>226051620</id>
      <created>Wed, 20 Oct 10 23:17:23 +0000</created>
      <timezone>America/Chicago</timezone>
      <user>
        <id>76040</id>
        <firstname>tracy</firstname>
        <lastname>apps</lastname>
        <friendstatus>friend</friendstatus>
        <homecity>Milwaukee, WI</homecity>
        <photo>http://playfoursquare.s3.amazonaws.com/userpix_thumbs/NVS3B4M3YFMHTPZN.jpg</photo>
        <gender>female</gender>
      </user>
    </checkin>

And here’s a user named “Ty S.” who I do not know…

    <checkin>
      <id>226136078</id>
      <created>Thu, 21 Oct 10 00:20:45 +0000</created>
      <timezone>America/Chicago</timezone>
      <user>
        <id>714868</id>
        <firstname>Ty</firstname>
        <lastname>S.</lastname>
        <homecity>Milwaukee, WI</homecity>
        <photo>http://playfoursquare.s3.amazonaws.com/userpix_thumbs/I1STUJNEAQGMGQJZ.jpg</photo>
        <gender>male</gender>
      </user>
    </checkin>

We can construct the URL to his Foursquare page using the id: http://foursquare.com/user/714868, and if the user has a username set, it will redirect to custom URL. (At least, it will if you are logged in with your browser.) We can also see their photo, so you could do something interesting with that as well. (There are no access controls on the images, you should be able to see any of those.) You can also see their homecity and their gender. I’m sure you can come up with an interesting Boys vs. Girls display using that data… And for a nightclub, well, it just seems fitting.

OK, well that’s all the time we have for now, keep on hacking… and if you build anything interesting with this info, please let me know.

Update: I probably should have linked to the API docs as well: http://groups.google.com/group/foursquare-api/web/api-documentation

12 replies on “Foursquare Fun – Who is Here?”

It would also be interesting to see if Gowalla or Facebook provides similar “checkedin” data so a venue could show people regardless of what service they use.

This is very cool. I really like the idea of telling people the current guy/girl ratio of the bar. My idea for this was to make a free iPhone app that replaced the hand counters that bouncers use to measure capacity. Of course, instead of buttons for +1 or -1, there would be 4 buttons. +1 girl, -1 girl, +1 boy, -1 boy. The data would be transmitted back to a server where you could go online and see a dashboard of all the major bars in Madison and their current girl/guy ratio.

Call it http://www.sausagefest.com

Hi,
thanks for how to … i tested it but i did’t get any in log. I want to make some tool for my Swarm attemp: show actual check-in counter (). But who is here list will be great. is it possible to make it this way?
Thanks

Mike

Mike, get the XML and look for the ‘herenow’ bit to tell you how many people have checked in within the last 3 hours… The next step would be parsing the XML to show the actual users.

I read some infos on net that this feature was dropped by Foursquare. I get XML from venue where I was chcecked. Maybe it was wrong. I’ll wait for another user on venue.

Mike

I just tested it, and as long as you pass your credentials (username/password) you should get an item named ‘checkin’ (not ‘checkins’) that contains the users that have checked in within the last 3 hours. If you do not pass in your credentials you will not see this ‘checkin’ item in the XML. You also won’t see it if no one is checked in. :)

Yes, It works! Thanks. Can You share Your code which parse XML? I thing about webpage with user counter, avatars and gender battle counter (girls vs. boys). But my knowledge of PHP are too limited.

Mike

Comments are closed.