I am having difficulties having the help page populate for a web api controller. The only method in the controller is the following:
public HttpResponseMessage Get(string p1,string p2= "blend", string p3 = "blend")
The method appears reflected in the help page with the signature:
GET api/mycontroller?p1={p1}&p2={p2}&p3={p3}
However none of my comments flow to the help page. For other simple controller Get(string id)
the help page works ok.
I tried adding the following on the WebApiConfig.cs
config.Routes.MapHttpRoute(
name: "mycontroller",
routeTemplate: "api/mycontroller/{p1}/{p2}/{p3}",
defaults: new
{
p1 = RouteParameter.Optional,
p2 = RouteParameter.Optional,
p3 = RouteParameter.Optional
}
);
But still the help page is not getting populated with the comments written for summary, param description or return.
Instead of trying to solve this with convention based routing in the setup I would use attribute routing.
First enable it in the WebApiConfig.cs
Then decore the method in the controller with the route