Skip to main content

Why use Atom Publishing Protocol for REST?

Posted by davidvc on March 21, 2007 at 10:48 AM PDT

I've been working with a group of folks here on prototyping an application architecture that presents relational entities as
endpoints (yes, I'm sure some of you have already done this, but now it's our turn :)).

We decided to build our REST services using the
Atom Publishing Protocol
, or APP. This is a common recommendation, and what's good for Google was good enough for us :).

But as we did the work, it seemed like a lot of overhead to put all this APP framework around a very specific application. Why not just use HTTP and JSON and have done with it?

Well, we didn't have a clear answer, so we thought we'd ask the experts here at Sun, and sent an email off to Tim Bray and Dave Johnson. Rather than (mis)quote what they had to say (or the conclusions of the other folks on the team), I'll summarize what my conclusions were at the end of this discussion. I'll let Tim and Dave (or anybody else) comment if they feel so inclined. But I do want to thank Tim and Dave for their very helpful and valuable input.

First of all, I think we should stick with Atom, even with the overhead. Why? Here are some of my reasons:

  • APP lets you post a new entry without having to know its URI. The protocol lets the server tell you where it put it as part of the response. This allows the server to allocate things as it sees fit, and decouples the client and server. This feature also seems key to me for solutions that need to scale -- you don't want to hardcode locations into the client.

  • Because APP and Atom are growing and popular standards, lots of products are or will be working with it. As a simple example, when I was testing my Atom server with my browser, at first I was just getting raw XML displayed (through a plugin). But when I finally got the response right and sent a valid Atom feed, all of a sudden Google Reader popped in and asked me if I wanted to subscribe to the feed. Sweet!

    I tried to subscribe, but it didn't work, because Google didn't know how to connect to localhost. But Firefox Live Bookmarks worked great!. My content is in JSON so it's not too helpful, but if I had an alternative HTML representation, people could subscribe to my service without any effort on my part.

  • Because APP and Atom are growing and popular standards, people are providing and will continue to provide tools to make it easy to build APP servers and clients. ROME and Apache Abdera are just two examples of this.

  • Finally, supporting APP makes me buzzword-compliant. All things being equal, there's something to be said for that :)

So, tell me what you think. Am I missing anything? When do you think it doesn't make sense to use Atom/APP for your REST service?