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

Jesse Vincent jesse at bestpractical.com
Tue Dec 4 17:44:58 EST 2007


> In summary, I've come up with these guidelines regarding the REST
> implementation:
> 
>    1. Make sure the response content gives enough information to be used
>    to make additional GET or PUT requests regarding the same object after a
>    create or update.
>    2. If we create something, we SHOULD return 201 with a Location:
>    header referring to it. But it's more important that we describe what's
>    going on in the response (which we do).
>    3. We need to avoid 200 responses with a Location: because that seems
>    to be a hard-coded rewrite for Apache (in my experience) to rewrite the
>    response as a 302 with a Location:, which does not mean the same thing as a
>    200 response as far as REST clients are concerned. (Actually, 302 is a kind
>    of an ambiguous response anyway since user agents don't actually tend to
>    follow the spec when handling it, particularly since 302 can be used as a
>    substitute for 302 for backward compatibility with HTTP 1.0 agents. A
>    303 tends to be the preferred REST way of communicating "Look over there" in
>    a response.)


All that seems pretty reasonable. I do wonder how/if it applies to
non-CRUD actions. (Functional programming with RESTy interfaces seems like a
potentially interesting topic for a conference presentation)

> 
> I like my original proposal, but as long as we clear out the Location header
> in most responses, I'm good.

Then run with it for now. And add a Jifty-REST-Version: 0.9 header to
what we serve? ;)

> Cheers,
> Sterling

> _______________________________________________
> 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