users@jersey.java.net

Re: [Jersey] Guidelines on which response code to use

From: Martin Matula <martin.matula_at_oracle.com>
Date: Fri, 17 Sep 2010 18:02:39 -0700

Hi Toffer,

On Sep 17, 2010, at 1:29 PM, tofferliu wrote:

>
> Hi,
>
> I'm not sure what response code to return for logical errors, like
> invoking
> a method on an item which does not exist. If I called something like
> "paintCar(carId)" and carId is syntactically correct but it does not
> exist
> in the repository. It doesn't seem intuitive if I returned a 404?

Why does it seem unintuitive? 404 - Not found - is exactly for that -
user is trying to reach a resource which does not exist.

>
> Is there a document I can use as a reference for this? I did a little
> looking and I didn't find anything better tailored to REST apart
> from the
> standard definitions you can find in wikipedia.

The HTTP specification? http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Martin