In WebApiConfig
I've added to routes :
config.Routes.MapHttpRoute(
name: "v1_Api",
routeTemplate: "api/v1/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.Routes.MapHttpRoute(
name: "v1_ApiAction",
routeTemplate: "api/v1/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
In ApiController I have 2 GET
Actions :
[HttpGet]
public async Task<IEnumerable<RequestModel>> Pending(){}
[HttpGet]
public async Task<IEnumerable<RequestModel>> Resolved()
When I tried to call one of this action from AngularJS service I got 500 Error.
Multiple actions were found that match the request
When I left only second route, that match my Action - it works well.
"/api/v1/RequestRecipient/Pending"
In what can be problem in case of 2 routes?
id
. You may need to add a constraint because as it stands the path you showed will match both templates as id is optional