Open shreesharao opened 5 years ago
ModelState is only validated if it's able to successfully deserialize the post body/bind.
You were not specific in your question, but it sounds as if you're posting as x-www-form-urlencoded. If that's the case, you should not have [FromBody]. However, bear in mind that it's an either/or situation, so if you want to eventually post via JSON, then you should keep the attribute and post JSON from Postman instead.
Aside from that, ensure that you're either not using antiforgery token validation or that you are posting a valid token along with the request. Failing antiforgery validation will short circuit the request and return a 400 immediately.
If you are posting JSON, ensure that your JSON is valid. If the JSON is invalid, you'll get a 400 immediately.
When calling the API -
I am getting 400 bad request.