[annotator-dev] Yet Another Store Implementation (Ruby/Rails)
nick at whiteink.com
Mon Nov 3 17:36:56 UTC 2014
On Mon, Nov 3, 2014, at 06:57, Benjamin Young wrote:
> Great work, King'ori!
> I agree with your analysis that 303 See Other isn't quite the right
There's nothing wrong with using 303 to refer the client to the newly
created resource. Indeed, that's exactly the intended use of 303.
You'd POST to a create action, and receive
HTTP/1.1 303 See Other
to direct the client to the new resource. The only reason the store
implementation doesn't do this is because browsers didn't correctly
propagate CORS headers and authorisation across the redirect at the
It's ok to return 201 from the POST action, but the semantics,
particularly around caching, are a bit messy. The body of the response
in the case of a POST should not, strictly, be a representation of the
resource created, as its URI is not the URI of the POST endpoint. So, if
you return a 201, you should refer to the newly created resource in a
Location header (as with a 303) with the disadvantage that browsers
won't interpret this as a redirect.
More information about the annotator-dev