I hav a web api project (C#, asp.net MVC) where I need to be able to call actions both, using template api/{controller}/{action}/{id} and api/{controller}/{id}. To do this, I've added 2 routes for api controller:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional },
constraints: new { action = @"^[a-zA-Z]+$" }
);
config.Routes.MapHttpRoute(
name: "RestFull",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional });
So now if I have controller MyController and method Delete, I can call it both DELETE api/MyController/Delete and DELETE api/MyController; Also I have auto-generated api help and after I've added second variant of the routing - some methods are now displayed two times in the help.
What I want is to have only one reference in the help, for each action. Is it possible? Or maybe something is wrong with my routing and I can have multiple GET/POST methods, just using "api/{controller}/{id}" template?