0

What status code should I set if validation of an object fails in a POST. Using Rest.

Raedwald
  • 43,666
  • 36
  • 142
  • 227
pethel
  • 5,068
  • 12
  • 52
  • 84

3 Answers3

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
1

The most appropriate one would probably be 400, "Bad Request." The 4xx status codes correspond to client errors.

jonvuri
  • 5,496
  • 1
  • 22
  • 32
1

422 comes to mind (see http://greenbytes.de/tech/webdav/rfc4918.html#STATUS_422)

Julian Reschke
  • 37,619
  • 8
  • 86
  • 92