9670Re: [rest-discuss] 30x Status codes
- Oct 2, 2007Julian Reschke wrote:
> Brandon Carlson wrote:From the POV of a GET a 303 and 307 are very similar. However, a 307
> > Let's assume a RESTful weather service with the URIs looking
> > something like this:
> > # Daily forecast
> > forecast/2007/ 10/02
> > # Today's forecast
> > forecast/today
> > I would expect the URI for today's forecast to redirect to the
> > forecast for today's date. My question is which redirect to use. My
> > first thought is that I would use a 301, but then, the more I
> > thought about it I think a 302/307 is the correct choice.
> > What does the group think?
> It's a temporary redirect, so 307 would be correct.
> However, where's the point in forcing the redirect at all?
is a "temporary redirect" which to me implies "I've moved the resource
over there for a little while, but next time you need it it might be
back here." While a 303, "see other," says to me "I understand what
you're looking for, and I'm sending you over there to get it."
Why redirect? Quoting the RWS book " The 303 status code is a good way
to canonicalize your resources. You can make them available through many
URIs, but only have one "real" URI per representation. All the other
URIs use a 303 to point to the canonical URI for that representation.
For instance, a 303 might redirect a request for
http://www.example.com/software/current.tar.gz to the URI
From the same source, 302 is to be avoided due to ambiguity issues.
- << Previous post in topic Next post in topic >>