I m new to WebAPI and just exploring its default sample "value" controller which is there out of box with project.
I see it was already having two Get methods:
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
I tried and changed int id with a complex type and received "Multiple actions were found that match the request"
Why is that it was working fine beofre ?
My route is defuatl:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
I m passing a complex object in body using Get methoed, I know it is not Restful way but please help me understand it.
Much appreciated.