Chutney.js

A simple little jQuery library for accessing Rotten Tomatos' API with JSONP.

19 May 2013

Recently, I took part in a two day hack project at work. I can't say what it was for, but we needed a way to talk to Rotten Tomatoes.

Naturally, My first thought was to glance over the API and then have a look for any existing libraries that would make my life easier. We didn't need anything too complicated, we just needed to be able to browse RT's database and get further information on a particular film if we needed it, but I didn't come across anything that would have been massively helpful to us. (I'm writing this in retrospect so I don't remember too many of the details of the things I came across. If you've come across a RT library that you've found, let me know :D)

I took this as an opportunity to write my own. Whilst working on various projects recently, I've written quite a few Js API's so I've gotten a knack for writing quite quickly but this one is nothing special.

Like every other library out there you can include the script like so...

<script src="pathToFile/chutney.js"><script>

You have to make sure that you include Chutney.js after jQuery. Chutney relies on jQuery's AJAX request functionality - I chose this because whether you like jQuery or not, It deals with IE rather well. Christ knows I have no time for IE, Particularly when time's-a-ticking.

After you've made sure the script is being pointed to, the first method you should call is chutney.key(). In this function you should pass your API key that you can obtain from Rotten Tomato's developer portal, It's used to authenticate every request so you won't be able to get much out of RT without it. Once you've set it it, You can forget about it and make any request you like.

The methods are described on the Repo's Github page so I won't describe them here, but it is something I'm a little proud of. A fun little library to get at a, quite frankly, wonderful data set.