« Launching Overflow | Main | Building a startup - my first 30 days »

October 27, 2006

Bitten by the API

One of the dangers in using someone else's API to build an application or mashup is that it could change with side-effects you weren't counting on. That happened to us this morning, when an application we've been building that combines Ruby on Rails with the GoogleMaps and Flickr APIs started acting strangely.

On the day targeted for a customer demo - the markers stopped showing up on the GoogleMap. This only happened in Firefox - things were well in Safari and even IE7. Luckily I have Firebug installed in Firefox and therefore the error was quick to be found: "Bd(a, b, true).push is not a function ". Yeah, right.

A quick check of the GoogleMap group and it was clear that an API update was causing the problems.

You can define the version of the API you want to use in your JavaScript, so adding the version number of the API version that didn't show the problems was easy enough. Still, it shows the problems you can run into when you rely on someone else to provide the service.

The application we've built is to demonstrate how technologies like GoogleMaps can be used to construct customer community sites and it's been really fun to write.

Posted by Matthew at October 27, 2006 07:17 PM

Comments

Dare I mention Mapstraction? http://www.mapstraction.com/

Looks like it might just be the tool for the job, it ought to buffer you from the vagaries of the api a little, their blurb follows:

"Mapstraction is a library which provides a common API for Google, Yahoo! and Microsoft's javascript mapping APIs to enable switching from one to another as smoothly as possible. The aim of Mapstraction in mainly to protect companies building commercial products on top of Google Maps from changes to terms and conditions, the introduction of ads, or the emergence of a competing library with better maps, different imagery or preferable licensing terms."

Posted by: Jim Hughes at November 1, 2006 02:58 PM