[jifty-devel] Handling of responses to updates in REST

Jesse Vincent jesse at bestpractical.com
Fri Nov 30 14:12:02 EST 2007

[I don't have an opinion on this. It'd be nice to know what other RESTy
apps do]

On Wed, Nov 28, 2007 at 05:03:24PM -0600, Andrew Sterling Hanenkamp wrote:
> Okay, this came up this afternoon while working with Shawn's handy
> Net::Jifty utility. Basically, when you perform a PUT request to modify a
> record, REST response to a successful modification by setting a "Location"
> header that points back to the URL for viewing the resource. This doesn't
> precisely make sense, at least not after reading and rereading RFC 2616 on
> HTTP/1.1 and it doesn't seem to get consistent handling.
> When I run the standalone Jifty server, for example, this gets treated as a
> 200 response with the header "Location: /=/model/SomeModel/id/123" set. This
> is fine, other than being a violation of the absolute URL requirement here,
> but it's pretty widely understood how relative URLs should be handled here.
> However, when I run it under FastCGI (actually fcgid) on Apache, the
> response is altered into a 302 response with the "Location" header.
> After reading the HTTP spec carefully, I think the ideal handling would be
> as follows:
> On Create:
> 201 Created
> Location: /=/model/SomeModel/id/123
> Content-Location: /=/model/SomeModel/id/123
> On Update
> 200 Updated
> Content-Location: /=/model/SomeModel/id/123
> In the first case, I might also have the Location: header attach the ".yml"
> or other suffix if one was explicitly given in the request or not include
> the "Location" header at all and let the user agent do whatever it wants
> with the Content-Location header (in which relative URIs are okay).
> I am sending this to the list because it's a change of behavior and I don't
> want to kick anyone's puppy by changing it.
> Cheers,
> Andrew

> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel


More information about the jifty-devel mailing list