The wildcard will indicate to the routing engine that the rest of the URI matches the route parameter (for example, see the section "Get books by publication date" in this article ).
This does not mean that any arbitrary named variable matches any parameter - it is that by default WebApi uses elements in a querystring regardless of the configuration of your route (therefore, why you used the second URI - it did not match any route).
It does not match {id} in your route because it was expecting a parameter named {wildcard} that was not marked as optional.
To illustrate, if you just changed the "wildcard" to "abc":
config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}/{*abc}", defaults: new {id = RouteParameter.Optional});
Then it will successfully match the following URI:
http://mymachine.com/api/Individual/1/a/b/c
With id=1, abc=a/b/c
To fix, just remove the template from your route so that it looks like this:
config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new {id = RouteParameter.Optional});
gooid source share