Frederick The Fool Frederick The Fool - 1 year ago 174
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download