My most popular app, Which Episode?, is powered by trakt.tv‘s API. It uses the API to search for shows when you enter a name, and to download show posters.
It takes exactly one API call to grab all the info I need. If the user enters in ‘Supernatural’, the app simply makes an HTTP request to http://api.trakt.tv/search/shows.json/[my API key]/supernatural. The resulting JSON includes everything about shows matching the search terms, including URLs for the show’s posters.
This is fantastic, and it’s exactly what I would expect from the API.
Unfortunately, the cracks in trakt’s API begin to show once you start looking at more advanced scenarios.
The app I’m currently working on requires the retrieval of information on recently released movies, or movies that are currently playing in the theater. Figuring out how to retrieve this info from trakt is an exercise in futility.
You could try to retrieve http://trakt.tv/api-docs/movies-trending to get a list of trending movies… but just because a movie is trending doesn’t mean it’s actually new, so you’ll have to filter the results based on whether or not they are actually new. More importantly, just because a movie is new, doesn’t mean it’ll be trending, so you’re not actually going to get all the movies you want to. It’s also a nearly 200K chunk of JSON – not something you want to be grabbing on a regular basis from a mobile device.
You could also try to keep a local copy of all the (recent) movies in the database using the http://trakt.tv/api-docs/movies-updated endpoint. This call gives you the timestamps of when the record for each movie was updated. Using this, along with a boatload of API calls (you’ll need one for each movie), you should be able to keep track of new movies and their release dates.
Both of these methods are, to put it mildly, inadequate. And they reveal the biggest problem with trakt’s API:
It doesn’t support server-side sorting, pagination, or result limiting!
Pagination was requested on trakt’s Google Group a few months ago, but the thread has no responses. I asked a question about retrieving movies by release date a week ago, and my thread has had no responses.
If I could retrieve the top n movies, sorted by release date, life would be great. It’s not even a breaking change from an API design point of view – all it takes is support for a few extra parameters in the query string. I could envision using it like this:
http://api.trakt.tv/something/somethingelse.json/[my API key]?sort=release_date&count=20
The lack of support for such things is why I’ll be switching away from trakt for my upcoming app. It’s too bad, because aside from these limitations, trakt has been fantastic.
One of the alternatives I’m investigating is the Rotten Tomatoes API. I haven’t dug too deeply, but it appears that it has far more functionality than trakt – for example, individual endpoints for Box Office Movies, Upcoming Movies, In Theater Movies, and Opening Movies. Pretty slick!
Here’s hoping the rest of it works as well as trakt does.