atom pub, gdata, and one way to improve amazon+alexa

Has anyone tried using Amazon’s “RESTful” webservices? I’ve had many headaches using them. If I’m using PHP, I like to use nuSOAP to access SOAP services, because PHP’s facilities for XML (at least in version 4) are terrible. nuSOAP seems to have interop issues with some of Alexa’s/Amazon’s webservices, so that’s a pretty big turn off. The authentication requirements remain difficult/painful to implement, for some reason, even after doing it several times.

The focus on composability seems like a pretty nifty idea, however. S3 for storing things, and SQS for Queue services, EC2 is very cool for providing machines to run code on. The only problem is once you develop a client for one, you don’t have a working client for the others. They failed to provide a polymorphic interface to their services! On the web, this is really really bad form. In my short lived and naive experience, writing web services is primarily about two things:

  1. exposing some logic controlling a persistence layer
  2. organizing resources into logical units

These two activities become idioms, which become patterns. Open standards can save you a lot of work when it comes to interoperability issues, because they help define, or at least imply, how these patterns should be implemented. If amazon had used Atom Publishing Protocol, instead of the framework they are currently using, a single client implementation would be capable of consuming all their web services. What a mistake to not use it.

Furthermore, it’s a bit confusing as to why they labeled these services as RESTful to begin with, especially because they ignore the stateless requirements of GET, and put methods in the URIs. Any parser implementation intended as a component of a consuming application must learn how to individually parse each resource’s XML indepedently from the rest.

I’m not saying Atom Publishing Protocol is some magic silver bullet. I am suggesting that Atom Publishing Protocol helps you with one of the main tasks of developing web services: organizing and exposing resources.

Is anyone doing this? Yes. Google has added some extensions to Atom Publishing Protocol, and has called it GData. If amazon wants to compete with google in terms of being a platform, it’ll need to simplify the ways consumers get access to resources while increasing the surface area of exposure. One way to do that is to make sure that the burden for developers is very low, such as providing a single consistent interface (which HTTP already provides, and web architecture strongly implies) capable of consuming all your resources.

Common’ Amazon! Fight NIH! Don’t re-invent: re-use the known good patterns and idioms for publishing on the web. Atom publishing protocol is one possible codification of those common idioms and patterns, and it’s an open standard. It might not work out, but it’s certaintly seen a lot more peer review than your unRESTful web services model.


Post a Comment

Required fields are marked *

%d bloggers like this: