Foursquare API v2 is Public, v1 Deprecated

Popular location-based social network Foursquare quietly made the long-teased new version of its API publicly available Tuesday. The changes, embraced by its developer community, include JSON-formatted responses and OAuth-only Authentication. Even though the new API is characterized as in beta, the company has also deprecated the previous version, announcing it will no longer be available by the middle of next year.

Along with the new API there is a new developer portal for it, providing Documentation, an interactive API explorer, sample applications (with Source Code) and a thorough changelog, which reports that as of 12/7/10, "API is soft-lauched. You're no longer required to keep it secret!"

It wasn't exactly a secret before. Co-founder Dennis Crowley recently told TechCrunch that the forthcoming version of the API was "1,000 times faster" than the old one. Early access had even been granted to some developers who requested it, with other co-founder Naveen Selvadurai lately publicly advertising as much.

Nothing about this new version comes as much of a surprise, either. One reason for that is that open discussion of the new API by Foursquare's engineering team started over six months ago, allowing ample time for input and feedback. The two biggest changes in the new version—dropping support for XML and basic username/password authentication in favor of JSON and OAuth 2.0 exclusively—have been clearly flagged since then.

Another reason is that those big changes follow trends in API design that are coming to predominate, particularly in the realm of socially based services. We've been chronicling JSON's emergence over XML as the developer's choice in data formats, it's no surprise that Foursquare is moving in that direction.

Like JSON, OAuth, the open protocol for API authorization, has been gaining momentum all year. It was crowned by some as "the new hotness" back in May. Since then our directory has seen a a 50% increase in APIs using OAuth, from 76 to 116 today.

Twitter went OAuth-only over the summer, in what some frustrated developers forced to retool their applications called the "OAuthocalypse". Facebook's Graph API, launched back in April and replacing the service's older APIs, has used OAuth from the start. With the popularity of Foursquare mashups, we might see similar OAuthocalypse issues when the location startup shuts off v1 of its API in mid 2011.

The first version of Foursquare's API included OAuth 1.0 along with basic authentication. The change is both dropping basic authentication and moving to OAuth 2.0. OAuth 2.0 is an evolution of the protocol intended to be more developer-friendly, using secure HTTPS requests instead of plain text HTTP to avoid a complex, multi-step token exchange required in OAuth 1.0.

Interestingly, the trends Foursquare is following are particularly trendy among its closest peers. Facebook's Graph API actually started off with OAuth 2.0 and has only ever used JSON as a data format. (Facebook even helped lead the creation of the new version, initially in the form of something called OAuth WRAP.) The smaller-but-still-scrappy location-based social service Gowalla also supports 0Auth 2.0 (though still has a basic authentication/ API Key system as well) and is JSON-only.

Foursquare, Gowalla and Facebook are an interesting trio to see converging. Since Facebook entered the location game they're the three biggest players. Foursquare was the first to offer a writable API allowing third party apps to let users check-in to locations. Gowalla's API got (official) write support only a few weeks before Facebook announced its location-based "Places" feature in August. Facebook provided a read-only API for Places to all but a few select partners from the feature's launch until opening write access to all last month. Now Foursquare is the one playing catch-up, dropping XML support and joining its two competitors on the short list of services leading the industry in the move to OAuth 2.0.

The location-based social networking scene gets a lot of hype, but at least in terms of API competition and innovation it really is heating up. Just last week, Gowalla announced a major feature update, which it characterized as "the most significant update to the service we’ve ever released" on the company blog. Gowalla "now supports checking in on both Facebook Places and Foursquare" by linking a Gowalla account to a user's corresponding accounts on the other services. The same APIs all three companies are racing to improve on various fronts allows Gowalla—which some might characterize as an also-ran at this point—to attempt a power-play by being first to admit its users probably want to access the other services too.

It's certainly a tangled (location-aware) web being woven. Foursquare has benefited a lot from the creative energy of third-party developers, whose novel integrations help the service make headlines. It's only right that the service should be providing them with the best tools it can. We'll see if continuing to improve its API can help Foursquare maintain its current momentum.

(Hat tip to Jeff Wilcox for pointing out the release.)

Be sure to read the next Mapping article: Give Santa Directions with Open MapQuest API