Reputation: 7563
I have an URI, that is available by POST.
It requires 4 POST params.
What HTTP response status code should I use if user doesn't pass me all the required params?
406?
Upvotes: 0
Views: 141
Reputation: 6078
You better use 400 instead of 406:
406 Not Acceptable The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.[2
400 Bad Request The request cannot be fulfilled due to bad syntax.[2]
Also, you can generate an Exception
that would be better since you can write a custom error that indicates what is wrong with the request.
Upvotes: 1