What status code should I set if validation of an object fails in a POST. Using Rest.
Asked
Active
Viewed 219 times
3 Answers
5
400 Bad request - http://restpatterns.org/HTTP_Status_Codes
see also: REST HTTP status codes for failed validation or invalid duplicate

Community
- 1
- 1

alexei-grigoriev
- 189
- 11
1
The most appropriate one would probably be 400, "Bad Request." The 4xx status codes correspond to client errors.

jonvuri
- 5,738
- 3
- 24
- 32
1
422 comes to mind (see http://greenbytes.de/tech/webdav/rfc4918.html#STATUS_422)

Julian Reschke
- 40,156
- 8
- 95
- 98
1