Data Driver

Blog archive

Beer? There's an API for that!

I've been fooling around with REST services, getting JSON data back from free online sources and displaying it in Web or Windows Store apps via a ListView or FlipView, and so on.

After experimenting with the Windows Azure Mobile Services, which simplifies the back-end data-access process and lets you easily set up your own services, I was trying out other APIs and just had to pass on my latest discovery: beer.

Yup, there's an Open Beer Database, described as "a free, public database and API for beer information." Now, that's my kind of information. Not that I'm a lush or anything, but a beer API seems appropriate for these stressful times, what with the end of the world coming—and, worse yet, a holiday stay with the in-laws and family circus if civilization survives the predicted apocalypse. Then there's climate change, earth-destroying asteroids, sovereign insolvency, the fiscal cliff and Gangnam Style (hey, if you're talking Korean madmen druthers, give me that whacky Kim Jong Un and his ballistic missile toys in the North over Psy and his garbage music in the South any day).

Anyway, note that the Open Beer API "is currently a work-in-progress and is subject to change without notice." It returns data in JSON or JSONP (to work around cross-domain calls). It provides the usual CRUD operations via HTTP verbs GET, POST, PUT and DELETE and lets you retrieve breweries or beers, both as aggregates or singly by ID number.

For example, the beer with an ID of 2 is named the Bruin. Its description includes: "At once cuddly and ferocious, it combines a smooth, rich maltiness and mahogany color with a solid hop backbone and stealthy 7.6% alcohol." Hmm, cuddly and ferocious, much like that cute little Kim Jong Un himself (Psy is neither; I can't say here what Psy is).

The Open Beer Database includes an example for retrieving brewery information in JSONP format via JavaScript. It also points to client libraries for Ruby, PHP and Python.

So check it out the next time you're looking for an example REST service to toy around with, maybe over the holiday break. Me? I'll be up in Massachusetts, probably pounding Bruins (and I don't mean the local hockey team up there.)

Do you know of any wild and crazy REST APIs we can play with in our coding adventures? Please share your suggestions here or drop me a line.

Posted by David Ramel on 12/13/2012


comments powered by Disqus

Featured

Subscribe on YouTube