tags:

views:

26

answers:

1

Hi,

I have a scenario where a client Posts to a resource and if the data in the post is not valid then I want to return back a error saying what caused the failure. I am thinking that a 409 with a response body is appropriate? anyone any thoughts or suggestions on a different response?

Cheers,

Chris

+1  A: 
  • 400 means the request as such was not understood (e.g. bad syntax)
  • 409 means request understood but there is a conflict the client might solve (e.g with PATCH)
  • 415 means the submitted media type is not understood by server
  • 422 means the data was syntactically correct but semantically wrong

What do you mean by 'not valid' HTH,

Jan

Jan Algermissen
Say in the request there is an email address and i validate it before returning a response, if that validation fails i want to return back a message saying that the email address validation has failed accompanied by a suitable response code
Chris Woods
422 is the closest to your scenario.
Darrel Miller
Hmmm 422 is a WebDAV standard code and i don't want to use those?
Chris Woods
It's fine to use 422 it's in the IANA list, it's used by Rails and best of all it's semantically a good fit for what you need.
Chris McCauley
Here is the IANA list http://www.iana.org/assignments/http-status-codes
Darrel Miller