I can't seem to reach an endpoint using the POST method but the very same endpoint works fine when using the endpoint as a GET method. I have mentioned two endpoints below, one of which is a GET method and the other one is POST method.
The GET endpoint which is working fine looks like this:
[Route("api2.0/Checklist/Create")]
[HttpGet]
public void Create()
{
JsonResponse.NewResponse("METHOD HIT!");
}
The response I get in postman when I run endpoint above using the URL GET: http://localhost:10001/api2.0/Checklist/Create/ is:
{
"Success": true,
"Message": "METHOD HIT!",
"RedirectLink": null,
"ErrorType": 0,
"Payload": null
}
BUT when I run the same endpoint with a POST
method from Postman using POST: http://localhost:10001/api2.0/Checklist/Create/
on this endpoint:
[Route("api2.0/Checklist/Create")]
[HttpPost]
public void Create()
{
JsonResponse.NewResponse("METHOD HIT!");
}
The response I'm getting is:
HTTP Error 404.0 - Not Found
My routing config looks something like this:
config.Routes.MapHttpRoute(
name: "ChecklistController",
routeTemplate: "api2.0/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
I also tried changing the post method URL to https from http but that doesn't seem to work either.
Any help would be appreciated! Thanks