Publish Subscription Service

Publication/Subscription Service

The Publication/Subscription (Pubsub) service provides a simple service interface for publishing content to collections. This specific implementation focuses only on text content for the purposes of publishing service level messages for consumption by other services.

Relationship to the Atom Publishing Protocol

This implementation derives directly from the Atom Publishing Protocol (AtomPub). The one difference is that this service allows collection creation through POSTing a new entry to an undefined collection. For more information and a basic overview of AtomPub, visit the links below:

AtomPub Basics

The goal of AtomPub is to manage collections of entries. Most things that can be defined in terms of a collection of things can be modeled on top of AtomPub. The service defines workspaces as well, which are simply organizational hints to help keep collections of collections organized. The focus though in on the collections themselves and the entries.

Here is the basic RESTful protocol at a glance

HTTP Method URL Action or Operation
GET /service.xml This returns the service document. The service document lists the current collections along with their respective URL.
GET /{collection}/ Returns the representation of the collection resource as an Atom feed. Where the collection is very long, there may be atom:link elements that contain URLs to the previous and next set of collections. Currently this is not implemented. The entries are listed in descending order according to the app:edited element (xmlns="http://www.w3.org/2007/app" AtomPub namespace), which is a ISO date format.
POST /{collection}

The POST request body should contain a valid Atom Entry with a atom:content[@type='text']. A successful creation will return a status of 201 and include a Location header with the new entries location.

If the "collection" value is not specified, a new collection will be created.

GET /{collection}/{entry} This returns the Atom entry representation of the entry at the given URL.
PUT /{collection}/{entry}

The PUT request body should contain the Atom Entry that should replace the entry at the given URL. It is recommended that a GET request is performed, the representation should be edited and PUT back to the server.

The "entry" value mentioned above is a value composed of:

  1. 4 digit year
  2. 2 digit month
  3. 2 digit day
  4. Slug - The title stripped of invalide URI characters
  5. UUID part
The composition works in the following template:
/{year}/{month}/{day}/{slug}-{uuid part}

DELETE /{collection}/{entry} This deletes the entry at the specified location.

AtomPub Service Document

Below is a link to the AtomPub service document. This lists the collections that are currently available along with what kind of documents they accept. Currently they only accept Atom Entries with atom:content elements of type 'text'. This means any XML will be escaped before persisting. If you want to store XML or HTML, then you are responsible for tranforming the escaped values to the proper markup.

Service Document