Out of curiosity, I was trying to build API with the number of overloads.
Initially, I was getting the below error
-Multiple actions were found that match the request in Web Api
But again, I wanted to give some try in other way opposed to mentioned in the above link.
I went ahead & decorated my API with [Route] & here is how my API looks like.
namespace CTB_APP.Controllers.API.Delete
{
[RoutePrefix("api/test/")]
public class TestController : ApiController
{
    [Route("name")]
    public string Get(string param)
    {
        return param + 1;
    }
    [Route("age")]
    public int Get(int param)
    {
        return param + 1;
    }
  }
}
I was thinking that the above the API could be easily served at the respective endpoints.
http://localhost:51370/api/test/name?param=Chetan
http://localhost:51370/api/test/age?param=28
But this is returning the below error.
{ "Message": "No HTTP resource was found that matches the request URI 'http://localhost:51370/api/test/age?param=28'.", "MessageDetail": "No action was found on the controller 'Test' that matches the name 'age'." }
Please note Attribute routing is enabled.
WebAPIConfig.cs
config.MapHttpAttributeRoutes();
        config.Routes.MapHttpRoute(
            name: "ApiByAction",
            routeTemplate: "api/{controller}/{action}",
            defaults: new { action = "Get" }
        );
        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
How can I fix this??
Thanks.
 
     
     
    