Reputation: 1160
I have a very basic webApi built/running (pretty much template app, nothing more) in order to follow a training video. The GET and DELETE calls work fine, PUT and POST give a 400 error. Admittedly very new to all this so I'm looking for some basic direction as to how to troubleshoot. Pertinent screen shots follow, I'd be glad to provide others as requested. Thanks in advance.
Upvotes: 2
Views: 10784
Reputation: 25389
Mine is a development env on .net core.
This drove me nuts and lost 5 hours, all preventing post requests from either the browser calls or from Postman.
The following three changes helped me in 3 different scenarios.
Upvotes: 0
Reputation: 1
I know this very old thread but may help someone so posting my answer. try updating your method attribute[HttpPost("New")] and call it as http:localhost//api/new.
Upvotes: 0
Reputation: 30565
you are trying to make POST request which needs string value in its body.
Step to the Body section of the Postman Request, select form-data
after that add value
as parameterName and This is test string
as parameter value
Upvotes: 4