Orthogonal URIs in the AtomAPI

Joe Gregorio

The URIs that you use for editing an Entry via the AtomAPI should be orthogonal to the URIs used for serving up the HTML.

This topic came up on IRC this morning, and instead of trying to refactor the conversation into a mini-essay I'll just post it verbatim.

Arien	   Morning, Joe
jcgregorio good morning
Arien	   Something that is missing in the RFC is moving an entry...
Arien	   (changing the URL of some resource)
Arien	   Wouldn't be able to tell you how to do  
	   that in a RESTy way as I was just telling Sam.
jcgregorio Hmmm, could you give me more details or an example?
Arien	   I'll give you an example. Yesterday Mark (Pilgrim) posted an entry,
	   then later changed its title... 
Arien	   ... and also its URL
Arien	   The old URL redirects to the new one
jcgregorio Mark uses Movable Type, do you know how MT goes about assigning URLs?
Arien	   I don't knwo the details but it uses the title to construct the URL...
Arien	   I *think* the old URL was
	   <http://diveintomark.org/archives/2003/07/21/atom_aggregator_behavior_data_level.html> 
	   but that 404s now (didn't yesterday if this was indeed the URL) 
jcgregorio ok, I'll ask him when he gets online
Arien	   Sorry, it was this one: 
	   <http://diveintomark.org/archives/2003/07/21/atom_aggregator_behavior_transport_level.html>
Arien	   Which now goes here: 
	   <http://diveintomark.org/archives/2003/07/21/atom_aggregator_behavior_http_level.html>
jcgregorio But what it sounds like is the old Entry was deleted and a new Entry created.
jcgregorio Or, if the URL is derived from the Title, then just editing the Entry 
	   and changing the Title could end up changing the URL 
Arien	   the latter
Arien	   But how do you map that to HTTP...?
Arien	   You can PUT the entry to a new URL, and then DELETE the old entry, but what about the redirect?
jcgregorio Ahh, important point
jcgregorio The URL used for editing does not have to be the same as the one the serves up the HTML
jcgregorio and actually shouldn't be
Arien	   Why is that?
jcgregorio When you do a GET on the URI for editing you need to get the XML of the Entry,
	   when you do a GET on the URI of the story in a browser you want it to return HTML 
jcgregorio now you can do
jcgregorio content negotiation
jcgregorio and I have done that with my implementation of RESTLog in Bulu, but it has it's downside
Arien	   I can think of a couple, yes..
Arien	   I don't see the link with this particular point ("moving URLs"), though?
jcgregorio Ok, the server-side is completely in control of the URI space for editing, so
jcgregorio if Mark had used the AtomAPI to generate his post then
jcgregorio the URI the server gave him back for doing GET/PUT for editing could look like:
	   http://diveintomark.org/atom.cgi/1254 
jcgregorio if this happened to be Mark's 1254th post to his weblog
jcgregorio now he can change the title willy-nilly as it were and this same URI is still good for editing
jcgregorio even if changing the Title of the Entry ends up changing the URL of the final HTML
Arien	   Okay, so then you are seperating the editing from the publication...
Arien	   Or private <-> public if you will
jcgregorio exactly
Arien	   Not sure if I like that, but I guess it'll work.
comments powered by Disqus