I donβt think 400 can be used for the whole business scenario. It can be used for basic data entry validation. In addition, it may be difficult for us to map other business logic to this error code. The error caused by this is mainly development-time errors that the developer will encounter, possibly during client coding.
Let's say all the parameters are correct and, for example, we pass the user account number into the request.
Thus, the request is no longer a bad request, the server can accept the request. But now he refuses to fill out a request on the basis of new available information, which - the account does not have sufficient balance.
I would suggest using 403 with the corresponding error message in these scenarios.
Another possible error code may be conflict 409. But this is used in scenarios in which the resource is in a state of consistency.
Rajender Saini Oct. 16 '15 at 0:09 2015-10-16 00:09
source share