Finally I have the solution. I was looking for routing configuration which can call the methods depending on the parameter type .
config.Routes.MapHttpRoute( _ name:="apiById", _ routeTemplate:="api/{controller}/{prodid}", _ defaults:=New With {.controller = "Products"}, constraints:=New With {.prodid = "^\d+$"}) config.Routes.MapHttpRoute( _ name:="apiByname", _ routeTemplate:="api/{controller}/{categoryName}", _ defaults:=New With {.controller = "Products"}) config.Routes.MapHttpRoute( _ name:="apiByAction", _ routeTemplate:="api/Products", _ defaults:=New With {.controller = "Products"})
The missing link was using the constraint on the first route specifying it to accept number values only. e.g. api/products/1 The second configuration handles the remaining requests like string values specified in the url for categoryname e.g api/products/books The third configuration routes to all the request to action method having no parameters
Also its important to use the correct parameter name routetemplate like prodid,categoryname . The name should be same as declared in the corresponding action method.