Chris Woods
Chris Woods

Reputation: 63

Response code when POST fails to complete

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

Upvotes: 0

Views: 262

Answers (1)

Jan Algermissen
Jan Algermissen

Reputation: 4978

  • 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

Upvotes: 1

Related Questions