0

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

Raedwald
  • 46,613
  • 43
  • 151
  • 237
pethel
  • 5,397
  • 12
  • 55
  • 86

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,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