Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error code for an invalid POST parameter

Tags:

rfc2616

What's the proper error code to return when a POST request has an invalid parameter? Say: a form takes data for an event, but the date provided is in the past; or a form takes data for a user registration, but the name provided is a number or any invalid person name.

like image 911
Maurício C Antunes Avatar asked Oct 20 '11 10:10

Maurício C Antunes


1 Answers

11.2. 422 Unprocessable Entity

The 422 (Unprocessable Entity) status code means the server
understands the content type of the request entity (hence a
415(Unsupported Media Type) status code is inappropriate), and the
syntax of the request entity is correct (thus a 400 (Bad Request)
status code is inappropriate) but was unable to process the contained instructions. For example, this error condition may occur if an XML
request body contains well-formed (i.e., syntactically correct), but
semantically erroneous, XML instructions.

(From RFC 4918)

like image 152
samuil Avatar answered Sep 22 '22 01:09

samuil