According to http://blogs.msdn.com/b/webdev/archive/2013/10/17/attribute-routing-in-asp-net-mvc-5.aspx#optionals-and-defaults
You can have optional parameters by adding a question mark (?) when using attribute routing. However it does not work for me (ASP.NET Web API 5).
[Route("staff/{featureID?}")]
public List<string> GetStaff(int? featureID) {
List<string> staff = null;
return staff;
}
If I use staff/1
etc it works fine, if I use /staff
I get the usual:
"No HTTP resource was found that matches the request URI..."
"No action was found on the controller that matches the request."
Am I missing a reference or something? Or doing it wrong?