Byon February 16, 2011 12:30 PM
O’Reilly Media is really fond of the ‘Cookbook’ format of technical guide. I’m guessing it sells well for them, and I’m glad because I happen to enjoy it. They’re good for reference for solving specific kinds of problems, and if you’re like me, they provide a solid ‘learn-by-example’ mechanism to learn how to work with a new technology or technique. It’s not ideal for everything, but it’s good. I’ve had web-service stuff hanging in the back of my head for a while, so I decided to pull the “RESTful Web Services Cookbook” by Subbu Allamaraju1 to stimulate my thinking on the matter.
And it worked greatly. This particular cookbook is of the ‘Patterns’ variety, as there is absolutely zero code anywhere in the book (XML and HTTP Headers don’t count). This never really feels like a weakness, since HTTP and XML (and even JSON) are all well supported across virtually every programming environment you could imagine.
While these cookbooks are not necessary to read from cover to cover, and this is no exception, I found it to be comfortable to read from that perspective. The chapters are organized such that they start with the simplest things that you need to know to work in REST, and then slowly layers on top of that with more detail and nuance that help to make a really stellar web service. And I suppose that you could be building a service while reading this book, though I found it short enough I’d probably suggest reading at least any potentially relevant recipes while in the design phase, since I think some recipes are easier to integrate into an existing design than others, though depending on your tolerance for changing the API, or the ease of your ability to keep multiple version endpoints, this may be more or less of a problem you.
I started reading this very shortly after I had put together an API for Washington State University Schedule data2, and I found this really inspiring. Our heaviest API user is using a few hundred megabytes per day, and the Queries chapter hinted me toward the way that I can reduce that usage dramatically by giving them more querying options, which incidentally also supports my plans for a Mobile site that can be completely API driven in the near future, and saves me from creating a ton of specialized endpoints when query parameters just make more sense. A lot of this book isn’t relevant to what I’m doing at this moment, since I’m working with GET only resources right now, but the more I play around with REST, the more I like it as a mechanism for web services, there is an elegance there that I don’t see in other web-based API standards, and it’s not really even a standard on it’s own, it just leverages other existing standards.
I think this is a great book for anyone working in REST. I have a few others on my reading list that I need to get to, but this one has definitely pushed my thinking on this technology in a way that has me really interested in how I can best design my services. I can’t say that it’s definitive, but I was really happy with having read it, and I look forward to reading more on the topic.