here is how I have routing setup.
routes.MapHttpRoute(
name: "Authors",
routeTemplate: "api/authors",
defaults: new { controller = "authors" }
);
controller action method
// GET /api/authors/
public string GetAuthors(string author_ids)
{
return data;
}
Url http://site.com/api/authors?author_ids=1 actually calls controller action but when I don't pass querystring parameter, it says no controller action matching found.
How to handle optional querystring parameter when defining route?