Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If "validation failure" means that there is some client error in the request, then use HTTP 400 (Bad Request). For instance if the URI is supposed to have an ISO-8601 date and you find that it's in the wrong format or refers to February 31st, then you would return an HTTP 400. Ditto if you expect well-formed XML in an entity body and it fails to parse.</p> <p>(1/2016): Over the last five years <a href="http://tools.ietf.org/html/rfc4918#section-11.2" rel="noreferrer">WebDAV</a>'s more specific HTTP 422 (Unprocessable Entity) has become a very reasonable alternative to HTTP 400. See for instance its use in <a href="http://jsonapi.org/examples/#error-objects-error-codes" rel="noreferrer">JSON API</a>. But do note that HTTP 422 has <em>not</em> made it into HTTP 1.1, <a href="https://tools.ietf.org/html/rfc7231#page-47" rel="noreferrer">RFC-7231</a>.</p> <p>Richardson and Ruby's <a href="http://rads.stackoverflow.com/amzn/click/0596529260" rel="noreferrer">RESTful Web Services</a> contains a very helpful appendix on when to use the various HTTP response codes. They say:</p> <blockquote> <p><strong>400 (“Bad Request”)</strong><br> Importance: High.<br> This is the generic client-side error status, used when no other 4xx error code is appropriate. It’s commonly used when the client submits a representation along with a PUT or POST request, and the representation is in the right format, but it doesn’t make any sense. (p. 381)</p> </blockquote> <p>and:</p> <blockquote> <p><strong>401 (“Unauthorized”)</strong><br> Importance: High.<br> The client tried to operate on a protected resource without providing the proper authentication credentials. It may have provided the wrong credentials, or none at all. The credentials may be a username and password, an API key, or an authentication token—whatever the service in question is expecting. It’s common for a client to make a request for a URI and accept a 401 just so it knows what kind of credentials to send and in what format. [...]</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload