O'Reilly logo

RESTful Web Services Cookbook by Subbu Allamaraju

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.2. When to Use Atom

The default content model of Atom feeds and entries consists of text, HTML, or XHTML content and summary, an identifier, links, authorship, categories, etc. This content model is best suited for publishing and syndicating snippets of information as feeds. However, since this format captures essential concepts that benefit most applications, it can be applied to a wide variety of scenarios and not just for content feeds. This recipe helps you determine whether Atom is a good fit for your web service.

Problem

You want to know if the Atom-format is appropriate for your web service.

Solution

Use Atom when the information model or metadata of resources naturally maps to the syntax and semantics of Atom feeds and entries. Even when the information model of resources does not map to Atom, consider offering Atom feeds with entries consisting of short text, HTML, or XHTML summaries of resources and links to them. Users can learn about those resources by relying on feed-capable tools such as feed readers.

Discussion

The Atom format has strong semantics for lists of snippets of information. Atom specifies elements for identifying the resource, related links, and metadata such as authors. However, it has relatively weak semantics for carrying data within atom:content and atom:summary elements. For example, consider the following Atom entry:

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"> <atom:title>Johnny Web Series Goes Anime</atom:title> <atom:id>urn:blog:1234</atom:id> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required