What's the proper error code to return when a POST request has an invalid parameter? Say: a form takes data for an event, but the date provided is in the past; or a form takes data for a user registration, but the name provided is a number or any invalid person name.
Error code for an invalid POST parameter
6.4k Views Asked by Maurício C Antunes At
2
There are 2 best solutions below
4

i would personally opt for: 400 Bad Request
the error should be in the 4xx range which represents client errors, because it is the responsibility of the client to transmit valid data.
anyway, you can have a look at a list of standard HTTP response codes and chose one that seems to fit your need.
(From RFC 4918)