Closed smolesen closed 11 years ago
The first route is the one that will match, as route precedence is determined by the order of the actions in a controller. Also, querystring params specified in the URL will have no effect in web api. If you want to have these work, do this:
// Define route prefix above....
[GET("")] // accessible at ~/test
public Whatever Get()
[GET("{id}")] // accessible at ~/test/123
public Whatever Get(string id)
Hi
Is it possible to have the following two actionmethods: [RoutePrefix("test")] public class MyController : ApiController {
[GET("")] public HttpResponseMessage Get() { ... }
[GET("")] public HttpResponseMessage Get(string id) { ... }
and hit the first one with:
~/test
and the second with:
~/test?id=123
I've tried using [GET("id={id}")] for the second one, but I always seem to hit the first one...
TIA
/Søren