I have a web api method:
[HttpPost, ActionName("GET")]
public string Get(string apiKey, DateTime start, DateTime end)
{
var user = db.Users.SingleOrDefault(u => u.Id == apiKey);
if (user == null)
{
return string.Empty;
}
var records = db.Histories.Where(h => h.Date >= start && h.Date <= end);
return JsonConvert.SerializeObject(records);
}
And here is the url I tried to call the method, but it doesn't reach to the method.
http://localhost:11847/api/History/Get?apiKey=398cfa9b-8c5c-4cf4-b4f3-8904a827ff22&start=2014-01-01&end=2014-12-01
I also have changed the WebApiConfig.cs
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}",
defaults: new { id = RouteParameter.Optional }
);
from "api/{controller}/{id} to "api/{controller}/{action}
