So I have few routes added in WebApiConfig.cs
file and I can get first & second call to work but can't get GADailyAPI calls to work. I get a 404. When the code was first written first two lines of routes were at the bottom and they would throw 404. I have tried changing the order but I can't get all of them to work. Any ideas? Note: This is not my code, so I don't want to to modify much of API code if I can. If I can figure out the routing order and fix it that would be the best solution
config.Routes.MapHttpRoute(
name: "GAMonthlyApiNetworkStats",
routeTemplate: "api/{controller}/{action}/{Year}/{Month}",
defaults: new { controller = "GAMonthlyAPI", action = "NetworkStats" }
);
config.Routes.MapHttpRoute(
name: "GAMonthlyApiAllStats",
routeTemplate: "api/{controller}/{action}/{Year}/{Month}",
defaults: new { controller = "GAMonthlyAPI", action = "AllStats", }
);
config.Routes.MapHttpRoute(
name: "GADailyApiNetworkStats",
routeTemplate: "api/{controller}/{action}/{StartDate}/{EndDate}",
defaults: new { controller = "GADailyAPI", action = "NetworkStats" }
);
config.Routes.MapHttpRoute(
name: "GADailyApiAllStats",
routeTemplate: "api/{controller}/{action}/{StartDate}/{EndDate}",
defaults: new { controller = "GADailyAPI", action = "AllStats" }
);
config.Routes.MapHttpRoute(
name: "GAMonthlyApiGroupStats",
routeTemplate: "api/{controller}/{action}/{Year}/{Month}/{GroupID}",
defaults: new { controller = "GAMonthlyAPI", action = "GroupStats" }
);
config.Routes.MapHttpRoute(
name: "GAMonthlyApiSiteStats",
routeTemplate: "api/{controller}/{action}/{Year}/{Month}/{SiteID}",
defaults: new { controller = "GAMonthlyAPI", action = "SiteStats" }
);
config.Routes.MapHttpRoute(
name: "GADailyApiGroupStats",
routeTemplate: "api/{controller}/{action}/{StartDate}/{EndDate}/{GroupID}",
defaults: new { controller = "GADailyAPI", action = "GroupStats" }
);
config.Routes.MapHttpRoute(
name: "GADailyApiSiteStats",
routeTemplate: "api/{controller}/{action}/{StartDate}/{EndDate}/{SiteID}",
defaults: new { controller = "GADailyAPI", action = "SiteStats" }
);