Foursquare Push API

nsanch edited this page Feb 19, 2011 · 3 revisions

To use the push API, come talk to us and we can whitelist you. We just need two pieces of information:

  • Your consumer name or ID -- this is available at http://foursquare.com/oauth/. (Create a consumer if you don't already have one!
  • An HTTPS URL that you'd like us to post checkins to. This must be on the same domain as your OAuth callback URL, and must have a valid certificate (not self-signed). AppEngine provides HTTPS access, as do many other hosting providers. You can also get a certificate for $10-15 at godaddy and other providers online, if your hosting provider doesn't offer it.

That's it! Once you're whitelisted, you'll start getting POST's for the checkins of all users that have authenticated to your consumer. The POST data will contain one JSON object, with two keys:

Here's a sample JSON object that you might see. (This is my checkin to General Assembly earlier today.)

{
    "checkin": {
        "createdAt": 1298129668,
        "id": "4d5fe304d7206ea8e90aeef1",
        "shout": "#4sqhackathon",
        "timeZone": "America/New_York",
        "type": "checkin",
        "venue": {
            "categories": [
                {
                    "icon": "http://foursquare.com/img/categories/building/default.png",
                    "id": "4bf58dd8d48988d125941735",
                    "name": "Tech Startup",
                    "parents": [
                        "Home / Work / Other",
                        "Corporate / Office"
                    ],
                    "primary": true
                }
            ],
            "contact": {
                "twitter": "gnrlassembly"
            },
            "id": "4c5c076c7735c9b6af0e8b72",
            "location": {
                "address": "902 Broadway, 4th Floor",
                "city": "New York",
                "crossStreet": "btw 20th and 21st",
                "lat": 40.739197437761383,
                "lng": -73.989760279655457,
                "postalCode": "10010",
                "state": "NY"
            },
            "name": "General Assembly",
            "stats": {
                "checkinsCount": 1357,
                "usersCount": 557
            },
            "todos": {
                "count": 0
            },
            "verified": false
        }
    },
    "user": {
        "firstName": "Neil",
        "gender": "male",
        "homeCity": "New York, NY",
        "id": "2097",
        "lastName": "Sanchala",
        "photo": "http://playfoursquare.s3.amazonaws.com/userpix_thumbs/0QYGOJMDGLTJOOQG.jpg",
        "relationship": "self"
    }
}
  • @nsanch