Frederick The Fool Frederick The Fool - 1 month ago 24
reST (reStructuredText) Question

HTTP Status code for malformed POST body

What status code should a REST service return in response to a POST request containing a malformed / unparseable message body?

Answer

400 Bad Request

Straight from the specification:

The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

Alternatively, if you need a more specific status you can create your own 4XX status for whatever API you might be designing.

Comments