Im using the New MVC Web Api I have something like this:
public class CustomersController : ApiController
{
public HttpResponseMessage Get()
{
//Return Somethings
}
}
I call it with /api/customers
now i want to be able to filter by nationality and id so i made this :
public class CustomersController : ApiController
{
public HttpResponseMessage Get(int Id, String Nat)
{
//and i filter here Return Somethings
}
}
if i try to use /api/customers/1/us it call the first method, i understand that these are query strings, so how do i define route so i can use /api/customers/1/us ?
Something like this should do the trick
And as a side note,
/1/usis not the querystring. Querystring is what it comes after?symbol on urls. For instance in your case, could be something like thisNot saying you need to change the url format, just explaining the concept.