I’m a fan of APIs, Web Services, and Mashups, and it’s no secret. One of my New Year’s resolutions is to create and publish more mashups, instead of simply lengthening my ever-growing ideas.txt file. A couple of weeks ago I relaunched, with little fanfare, DRM News, a domain I’ve owned for several years now. It’s simply an RSS aggregator from several sources revolving around digital rights management. It was trivial to slap together, to the point where I’d hardly consider it programming. But hey, at least I deployed something.
When I saw the Reddit post about the New York Times Best Seller API, I thought it would be a good opportunity to do a mashup for popular books. My hope was to create a site that could be on “auto-pilot” and maybe even send me a Amazon Associate check every now and then. I designed the site to use extensive caching of the NYT and Amazon APIs to minimize remote calls, but update the data often enough so that the information would be fresh. A few nights of hacking later and we have:
The NYT API was simple enough to use. The REST API offers three response formats, XML, JSON, or serialized PHP. I did find a bug in the API, and was very pleased how reactive the NYT API team was to resolve the problem. Kudos!
The guts of the mashup are simple. I’m using YUI for the layout and initial CSS, and JQuery for some visual effects on the list pages. On the server side, I’m using my current favorite thing ever, the Maintainable Framework. I was made aware of the framework by Mike Naberezny, one of the two main authors. Mike and I are ex-Zenders, and Mike was responsible for much of the code early on with the Zend Framework. The Maintainable Framework is very Rails-like, and because I’m familiar with some of the conventions in Rails, getting going with Maintainable was a cinch. Mike’s documentation is well-done, and I’m looking forward to using this framework for all things PHP for the foreseeable future, and hope to help out with bugs and maybe even some code.
Reading Radar is simple enough that I decided to forgo a database and just use a file based cache, powered by the Zend_Cache component of the Zend Framework. I’m using two caches, one that does not expire, and one that expired every several hours so that my data is fresh. I’m caching just a few API calls: the list of lists from the NYT API, which powers the left navigation; the actual lists themselves, which also provide book data; and the individual book histories. The NYT API offers a few other bits of information I’m not using, such as links to the first chapters and editorial reviews. The reason I don’t is because when I spot-checked several books, most of them did not have these links. My hope is that as the API matures, more of the data will find its way in.
To pull the Amazon information, I turn to the easy to use Zend_Service_Amazon component from Zend Framework. It provides me the ratings data, reviews, related products, images, number of pages, and so forth. So using the ISBN numbers from the NYT API, I’m able to query for the Amazon products, and spew those gratuitous affiliate links everywhere using the Amazon ASIN IDs.
So the end result, ideally, is that I have an automatically up-to-date site that I’ll never have to touch, is relevant to the search engines, and will generate passive income. Realistically, it was a fun way to spend a few evenings doing what I love: making mashups. The site is far from perfect, and I’m sure there will be bugs to squash.
I’m love to hear opinions and ways to make this little site better. I know my designer buddies could offer suggestions, and I’d be interested to hear from the affiliate marketing gurus about better ways to integrate the Amazon links better than I have. My real question is, how would you drive traffic to something like this, and would it even be worthwhile?
Jimmy Palmer and I have been thinking of some interesting ideas to extend sites like Reading Radar.. more on that as it develops.