UserPreferences

PaceSlugHeader2


Abstract

Adds an HTTP request-header to be used when creating entries. This header value is a "slug" (i.e. short name identifying the entry) that the server might use when creating an atom:id and/or URI for the entry.

Status

Proposed (Author: ThomasBroyer)

Rationale

Many existing weblog software implementations allow clients to type in a "slug" that the software will use to mint the entry URI (generally after filtering and transforming it). APP should also support this capability.

The "slug" here is a request-header so that it is set once when creating the entry and cannot be changed later.

Here is the [WWW]definition of "slug" from Wikipedia:

Proposal

Add to draft-protocol-09, before section 8.2:

8.2 Slug: Header

When posting a resource to a collection in order to add a new member, 
a client can include a Slug request header. The value of the header 
is a "slug", i.e. a short name identifying the entry. The server 
might use this information when creating the IRI of the newly-created 
resource (for instance by using some or all of the words in the last 
IRI segment). It might eventually also use it when creating the 
atom:id or as the title of a media link entry (see section 8.5).

  Slug = "Slug" ":" *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. To include 
characters outside [ISO88591] in the Slug header, they need to be 
encoded according to the rules of [RFC2047].

Servers MAY ignore the Slug request-header or they MAY alter its
value in any way before using it; for example, they mightfilter 
out some characters or replace accented letters with non-accented 
ones, spaces with underscores, etc.

Renumber following subsections and update section 8.3 (Example) to use the Slug request-header:

8.3 Example

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
    Slug: =?utf-8?q?Bill=20de=20h=C3=93ra?=

    <?xml version="1.0" ?>
    <entry xmlns="http://www.w3.org/2005/Atom">
      <title>Bill de h&#xD3;ra: one of the Atom Publishing Protocol editors</title>
      <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
      <updated>2003-12-13T18:30:02Z</updated>
      <author><name>John Doe</name></author>
      <content>Some text.</content>
    </entry>

The server signals a successful creation with a status code of 201. 
The response includes a "Location" header indicating the URI of the 
Atom Entry and a representation of that Entry in the body of the 
response.

    HTTP/1.1 201 Created
    Date: Fri, 7 Oct 2005 17:17:11 GMT
    Content- Length: nnn
    Content- Type: application/atom+xml; charset="utf-8"
    Content- Location: http://example.org/edit/bill_de_hora
    Location: http://example.org/edit/bill_de_hora

    <?xml version="1.0"?>
    <entry xmlns="http://www.w3.org/2005/Atom">
      <title>Bill de h&#xD3;ra: one of the Atom Publishing Protocol editors</title>
      <id>tag:example.org,2005-10-07:Bill_de_h%C3%93ra</id>
      <published>2005-10-07T17:17:11Z</published>
      <updated>2003-12-13T18:30:02Z</updated>
      <author><name>John Doe</name></author>
      <content>Some text.</content>
      <link rel="edit" 
          href="http://example.org/edit/bill_de_hora"/>
    </entry>

Note that the Entry created by the server might not match exactly 
the Entry POSTed by the client. In particular, a server MAY change 
the values of various elements in the Entry such as the atom:id, 
atom:updated and atom:author values and MAY choose to remove or 
add other elements and attributes, or change element and attribute 
values.

In particular, the publishing system in this example created a new 
atom:id for the entry, based on the suggested slug, and added an 
atom:published element.

Impacts

The Title header (section 8.4.1)

Notes

If we wanted to allow changing the "slug" for an entry (meaning also changing the entry URI; but absolutely not its atom:id as that would violate Atom semantics), then an entity-header or, better, an Atom extension element could be used instead. Note that the Slug request-header could also be used in PUT requests...


CategoryProposals