Network Working Group | J.C. Gregorio, Editor |
INTERNET DRAFT | BitWorking, Inc |
<draft-ietf-atompub-protocol-08.txt> | B. de hOra, Editor |
Category: Standards Track | Propylon Ltd. |
Expires: August 2006 | February 2006 |
The Atom Publishing Protocol
draft-ietf-atompub-protocol-08.txt
By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress”.
The list of current Internet-Drafts can be accessed at <www.ietf.org/ietf/1id-abstracts.txt>.
The list of Internet-Draft Shadow Directories can be accessed at <www.ietf.org/shadow.html>.
This Internet-Draft will expire in August 2006.
Copyright The Internet Society (2006). All Rights Reserved.
The Atom Publishing Protocol (APP) is an application-level protocol for publishing and editing Web resources. The protocol is based on HTTP transport of Atom-formatted representations. The Atom format is documented in the Atom Syndication Format (RFC4287).
To provide feedback on this Internet-Draft, join the atom-protocol mailing list (www.imc.org/atom-protocol/index.html).
The Atom Publishing Protocol is an application-level protocol for publishing and editing Web resources using HTTP [RFC2616] and XML 1.0 [W3C.REC-xml-20040204]. The protocol supports the creation of arbitrary web resources and provides facilities for:
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
Note: The Introspection Document allows the use of IRIs [RFC3987], as well as URIs [RFC3986]. Every URI is an IRI, so any URI can be used where an IRI is needed. How to map an IRI to a URI is specified in Section 3.1 of Internationalized Resource Identifiers (IRIs) [RFC3987].
For convenience, this protocol may be referred to as the "Atom Protocol" or "APP".
URI/IRI - A Uniform Resource Identifier and Internationalized Resource Identifier. These terms and the distinction between them are defined in [RFC3986] and [RFC3987]. Note that IRIs are mapped to URIs before dereferencing takes place.
Resource - A network-accessible data object or service identified by an IRI, as defined in [RFC2616]. See [W3C.REC-webarch-20041215] for further discussion on resources.
The phrase "the URI of a document" in this specification is shorthand for "an URI which, when dereferenced, is expected to produce that document as a representation".
Representation - An entity included with a request or response as defined in [RFC2616].
Collection - A resource that contains a set of member IRIs. See Section8.
Member - A resource whose IRI is listed in a Collection.
Introspection Document - A document that describes the location and capabilities of one or more Collections. See Section7.
The Atom Publishing Protocol uses HTTP to edit and author web resources. The Atom Protocol uses the following HTTP methods:
Along with operations on resources, the Atom Protocol provides list-based structures, called Collections, for managing and organising resources, called Members. Collections contain the IRIs of, and metadata about, their Member resources. For authoring and editing of resources to commence, an Atom Protocol client can examine Introspection Documents which represent server-defined groups of Collections.
Note that when an IRI is used for resource retrieval over HTTP, the IRI is first converted to a URI according the procedure defined in [RFC3987] section 3.1. The resource that the IRI locates is the same as the one located by the URI obtained after converting the IRI.
Client Server | | | 1.) GET to URI of Introspection Document | |------------------------------------------>| | | | 2.) Introspection Document | |<------------------------------------------| | |
Client Server | | | 1.) POST to URI of Collection | |------------------------------------------>| | | | 2.) 201 Created | |<------------------------------------------| | |
Once a resource has been created and its URI is known, that URI may be used to retrieve, update, and delete the resource.
Client Server | | | 1.) GET to Member URI | |------------------------------------------>| | | | 2.) Member Representation | |<------------------------------------------| | |
Client Server | | | 1.) PUT to Member URI | |------------------------------------------>| | | | 2.) 200 OK | |<------------------------------------------|
Client Server | | | 1.) DELETE to Member URI | |------------------------------------------>| | | | 2.) 200 Ok | |<------------------------------------------| | |
To list the members of a Collection the client sends a GET request to the Collection's URI. An Atom Feed Document is returned containing one Atom Entry for each member resource. See Section9 and Section10 for a description of the feed contents.
Client Server | | | 1.) GET to Collection URI | |------------------------------->| | | | 2.) 200 OK, Atom Feed Doc | |<-------------------------------| | |
The Atom Protocol uses the response status codes defined in HTTP to indicate the success or failure of an operation. Consult the HTTP specification [RFC2616] for detailed definitions of each status code. It is RECOMMENDED that entities contained within HTTP 4xx and 5xx responses include an explanation of the error using natural language.
The Atom Protocol Introspection format is specified in terms of the XML Information Set [W3C.REC-xml-infoset-20040204], serialised as XML 1.0 [W3C.REC-xml-20040204]. Atom Publishing Protocol Documents MUST be well-formed XML. This specification does not define any DTDs for Atom Protocol, and hence does not require them to be "valid" in the sense used by XML.
This specification uses a shorthand for two common terms: the phrase "Information Item" is omitted when discussing Element Information Items and Attribute Information Items. Therefore, when this specification uses the term "element," it is referring to an Element Information Item in Infoset terms. Likewise, when it uses the term "attribute," it is referring to an Attribute Information Item.
The namespace name [W3C.REC-xml-names-19990114] for the XML format described in this specification is:
purl.org/atom/app#
This specification uses the prefix "app:" for the namespace name. The choice of namespace prefix is not semantically significant.
This specification also uses the prefix "atom:" for "www.w3.org/2005/Atom", the namespace name of the Atom Publishing Format [RFC4287].
XML elements defined by this specification MAY have an xml:base attribute [W3C.REC-xmlbase-20010627]. When xml:base is used, it serves the function described in section 5.1.1 of URI Generic Syntax [RFC3986], establishing the base URI (or IRI) for resolving any relative references found within the effective scope of the xml:base attribute.
Any element defined by this specification MAY have an xml:lang attribute, whose content indicates the natural language for the element and its descendents. The language context is only significant for elements and attributes declared to be "Language-Sensitive" by this specification. Requirements regarding the content and interpretation of xml:lang are specified in Section 2.12 of XML 1.0 [W3C.REC-xml-20040204].
appCommonAttributes = attribute xml:base { atomUri }?, attribute xml:lang { atomLanguageTag }?, undefinedAttribute*
Some sections of this specification are illustrated with fragments of a non-normative RELAX NG Compact schema [RNC]. A complete schema appears in AppendixB. However, the text of this specification provides the definition of conformance.
For authoring to commence, a client needs to first discover the capabilities and locations of collections offered. This is done using Introspection Documents. An Introspection Document describes workspaces, which are server-defined groupings of collections.
Introspection documents are identified with the "application/atomserv+xml" media type (see Section15).
While an introspection document allows multiple workspaces, there is no requirement that a service support multiple workspaces. In addition, a collection MAY appear in more than one workspace.
<?xml version="1.0" encoding='utf-8'?> <service xmlns="purl.org/atom/app#"> <workspace title="Main Site" > <collection title="My Blog Entries" class="example.org/reilly/main" > <member-type>entry</member-type> </collection> <collection title="Pictures" class="example.org/reilly/pic" > <member-type>media</member-type> </collection> </workspace> <workspace title="Side Bar Blog"> <collection title="Remaindered Links" class="example.org/reilly/list" > <member-type>entry</member-type> </collection> </workspace> </service>
This Introspection Document describes two workspaces. The first, called "Main Site", has two collections called "My Blog Entries" and "Pictures" whose URIs are "example.org/reilly/main" and "example.org/reilly/pic" respectively. "My Blog Entries" is an Entry collection and "Pictures" is a Media collection. Entry and Media collections are discussed in Section7.2.4.
The second workspace is called "Side Bar Blog" and has a single collection called "Remaindered Links" whose collection URI is "example.org/reilly/list". "Remaindered Links" is an Entry collection.
The root of an introspection document is the "app:service" element.
The "app:service" element is the container for introspection information associated with one or more workspaces. An app:service element MUST contain one or more app:workspace elements.
namespace app = "purl.org/atom/app#" start = appService
appService = element app:service { appCommonAttributes, ( appWorkspace+ & extensionElement* ) }
The "app:workspace" element contains information elements about the collections of resources available for editing. The app:workspace element MUST contain one or more app:collection elements.
appWorkspace = element app:workspace { appCommonAttributes, attribute title { text }, ( appCollection+ & extensionElement* ) }
In an app:workspace element, the first app:collection element of each type MUST refer to the preferred or primary collection. In the following example, the "Entries" collection would be considered the preferred (or primary) entries collection of the workspace and the "Photos" collection would be considered the primary media collection:
<service> <workspace title="My Blog"> <collection title="Entries" class="example.org/myblog/entries"> <member-type>entry</member-type> </collection> <collection title="Photos" class="example.org/myblog/fotes"> <member-type>media</member-type> </collection> </workspace> </service>
The app:workspace element MUST contain a "title" attribute, which gives a human-readable name for the workspace. This attribute is Language-Sensitive.
The "app:collection" describes an Atom Protocol collection. One child element is defined here for app:collection: "app:member-type".
appCollection = element app:collection { appCommonAttributes, attribute title { text }, attribute href { text }, ( appMemberType & appListTemplate & extensionElement* ) }
The app:collection element MUST contain a "title" attribute, whose value gives a human-readable name for the collection. This attribute is Language-Sensitive.
The app:collection element MUST contain a "href" attribute, whose value gives the IRI of the collection.
The app:collection element MUST contain one "app:member-type" element. The app:member-type element value specifies the types of members that can appear in the collection.
appMemberType = element app:member-type { appCommonAttributes, ( appTypeValue ) } appTypeValue = "entry" | "media"
This specification defines two values for the app:member-type element:
To add members to a collection, clients send POST requests to the collection's URI. Collections MAY impose constraints on the media-types that are created in a collection and MAY generate a response with a status code of 415 ("Unsupported Media Type"). On successful creation, the response to the POST request MUST return a Location: header with the URI of the newly created resource.
Below, the client sends a POST request containing an Atom Entry representation to the URI of the Collection:
POST /myblog/entries HTTP/1.1 Host: example.org User-Agent: Thingio/1.0 Content-Type: application/atom+xml Content-Length: nnn <entry xmlns="www.w3.org/2005/Atom"> <title>Atom-Powered Robots Run Amok</title> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <content>Some text.</content> </entry>
The server signals a successful creation with a status code of 201 and the response includes a 'Location' header indicating the URI of the Atom Entry.
HTTP/1.1 201 Created Date: Fri, 7 Oct 2005 17:17:11 GMT Content-Length: 0 Location: example.org/edit/first-post.atom
A POST to a Media Collection creating a resource SHOULD contain a Title: header that indicates the client's suggested title for the resource:
POST /myblog/fotes HTTP/1.1 Host: example.org User-Agent: Thingio/1.0 Content-Type: image/png Content-Length: nnnn Title: An Atom-Powered Robot ...binary data...
The server MAY ignore the content of the Title: header or modify the suggested title.
Title = "Title" ":" [TEXT]
The syntax of this header MUST conform to the augmented BNF grammar in section 2.1 of the HTTP/1.1 specification [RFC2616]. The [TEXT] rule is described in section 2.2 of the same document. Words of *TEXT MAY contain characters from character sets other than [ISO88591] [ISO-8859-1] only when encoded according to the rules of [RFC2047] [RFC2047].
Entry Collections are collections that restrict their membership to Atom Entries. They are identified by having an app:member-type of "entry". Every member representation MAY contain an atom:link element with a link relation of "edit" that contains the IRI of the member resource. Member representations MAY contain a pub:control element.
To avoid unintentional loss of data when editing entry collection members, Atom Protocol clients SHOULD preserve all metadata, including unknown foreign markup, that has not been intentionally modified.
Media Collections are collections whose member representations are not constrained. They are identified by having an app:member-type of "media".
When listing the contents of a Media Collection, every Entry in the Atom Feed Document MUST have an atom:content element with a "src" attribute containing the IRI of the media resource itself. This value may be used to update and delete resources as described in Section5.3. When creating a public, read-only reference to the member resource, a client SHOULD use this value.
Entries in a Media Collection MAY contain an atom:link element with a link relation of "edit" that contains the IRI of an Atom Entry document representing the metadata of the member resource. A client MAY use this to edit the metadata associated with the resource.
Collection resources MUST provide representations in the form of Atom Feed documents. Each entry in the Feed Document MUST have an atom:link element with a relation of "edit" (See Section 10.1).
The entries in the returned Atom Feed MUST be ordered by their "atom:updated" property, with the most recently updated entries coming first in the document order. Clients SHOULD be constructed in consideration that changes which do not alter the entry's atom:updated value will not affect the position of the entry in a collection.
Clients MUST NOT assume that an Atom Entry returned in the Feed is a full representation of a member resource and SHOULD perform a GET on the member resource before editing.
Collections can contain large numbers of resources. A naive client such as a web spider or web browser could be overwhelmed if the response to a GET contained every entry in the collection, and the server would waste large amounts of bandwidth and processing time on clients unable to handle the response. For this reason, servers MAY return a partial listing containing the most recently updated member resources. Such partial feed documents MUST have an atom:link with a "next" relation whose "href" value is the URI of the next partial listing of the collection (the least recently updated member resources) where it exists. This is called "collection paging".
Atom Protocol servers MUST provide representations of collections as Atom feed documents whose entries represent the collection's members. The returned Atom feed MAY NOT contain entries for all the collection's members. Instead, the Atom feed document MAY contain link elements with "rel" attribute values of "next", "previous", "first" and "last" that can be used to navigate through the complete set of matching entries.
For instance, suppose a client is supplied the URI "example.org/entries/go" of a collection of member entries, where the server as a matter of policy avoids generating feed documents containing more than 10 entries. The Atom feed document for the collection will then represent the first 'page' in a set of 10 linked feed documents. The "first" relation will reference the initial feed document in the set and the "last" relation references the final feed document in the set. Within each document, the "next" and "previous" link relations reference the preceding and subsequent documents.
<feed xmlns="www.w3.org/2005/Atom"> <link rel="first" class="example.org/entries/go" /> <link rel="next" class="example.org/entries/2" /> <link rel="last" class="example.org/entries/10" /> ... </feed>
The "next" and "previous" link elements for the feed 'page' located at "example.org/entries/2" would look like this:
<feed xmlns="www.w3.org/2005/Atom"> <link rel="first" class="example.org/entries/go" /> <link rel="previous" class="example.org/entries/go" /> <link rel="next" class="example.org/entries/3" /> <link rel="last" class="example.org/entries/10" /> ... </feed>
The Atom Protocol adds the value "edit" to the Atom Registry of Link Relations (see section 7.1 of [RFC4287]). The value of "edit" specifies that the IRI in the value of the href attribute is the IRI of an editable Atom Entry Document associated with a resource. In a Media Collection this IRI may be used to update the metadata associated with a Media Resource. In an Entry Collection this IRI may be used to update and delete the member resource itself. The link relation MAY appear in Atom Entry representations as well as Entry and Media Collections.
This specification defines an Atom Format extension for publishing control called Atom Publishing Control. The namespace name for the Atom Publishing Control's XML vocabulary is "example.net/appns/". This specification uses "pub:" for the namespace prefix. The choice of namespace prefix is not semantically significant.
namespace pub = "example.net/appns/" pubControl = element pub:control { atomCommonAttributes, pubDraft? & extensionElement } pubDraft = element pub:draft { "yes" | "no" }
The "pub:control" element MAY appear as a child of an "atom:entry" which is being created or updated via the Atom Publishing Protocol. The "pub:control" element, if it does appear in an entry, MUST only appear at most one time. The "pub:control" element is considered foreign markup as defined in Section 6 of [RFC4287].
The "pub:control" element and its child elements MAY be included in Atom Feed or Entry Documents.
The "pub:control" element MAY contain exactly one "pub:draft" element as defined here, and MAY contain zero or more extension elements as outlined in Section 6 of [RFC4287]. Both