Overview of the Atom Publishing Protocol
The Atom Protocol provides the means by which applications can publish content using ubiquitous Internet protocols and standards, like HTTP and the Atom Syndication Format. The publishing protocol defines four simple verbs: GET, POST, PUT and DELETE, or read, create, update and remove content respectively.
A core component of the publishing protocol is how a system should represent its content. For this, the Atom Publishing Protocol utilizes its sibling, the Atom Syndication Format. The Atom Syndication Format is a core Internet standard and uses XML to represent online content in the form of a “feed” and “entries.”
The format is simple enough that an example is the best way to illustrate how it works:
<feed> <title>The title of my feed</title> <subtitle>The description or summary of my feed.</subtitle> <entry> <id>123</id> <title>The title for my content</title> <content>Hello World!</content> </entry> <entry> <id>456</id> <title>My first post</title> <content>This my first post on my new weblog.</content> </entry> </feed> </textarea>
The example above defines a collection of entries called a “feed.” The title and description for this collection can be found in the <title> and <subtitle> XML elements respectively. Then the feed contains zero or more “entries.” And entry is a representation of a single piece of content that belongs to the collection or feed that contains the entry element.
To publish or edit content, a representation of the content that is to be manipulated is transmitted to an Atom Server over HTTP, the very same protocol used by web browsers to surf the web. The Atom Publishing Protocol makes use of several features supported by the underlying HTTP protocol, some of which are rarely used by web browsers.
The Atom Protocol is based upon four key operations found in HTTP. They are GET, POST, PUT and DELETE.
- GET is used to retrieve an Atom feed or entry from an Atom server.
- POST is used to create an Atom entry on an Atom server. This is accomplished by composing an
element (as defined by the Atom Syndication Format) containing all the properties you would like to associate with the new entry, and then making a POST request containing that element to an Atom server.
- The PUT method is used to update an Atom entry on an Atom server. This is accomplished by first retrieving an entry using the GET method and then making a PUT request to the Atom server containing an updated representation of the entry being updated.
- The DELETE method does just what it says: it deletes an entry. To delete an entry a DELETE request identifying the resource to be deleted is made to an Atom server.