Web API has no support for doing this so you will have to build it up yourself. While it's not that difficult, you should consider first if adding the example to the description itself won't get the job done good enough.
The View, where you should add the 3rd column:
Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml
Relevant snippet:
@foreach (var api in Model)
{
<tr>
<td class="api-name"><a href="@Url.Action("Api", "Help", new { apiId = api.GetFriendlyId() })">@api.HttpMethod.Method @api.RelativePath</a></td>
<td class="api-documentation">
@if (api.Documentation != null)
{
<p>@api.Documentation</p>
}
else
{
<p>No documentation available.</p>
}
</td>
</tr>
}
Quickly you then realize you need look at the ApiDescription model.
The most relevant properties of ApiDescription seem to be:
- ParameterDescriptions (collection of parameters. Exposes: Name, Source, Documentation)
- ResponseDescription
These are the basics. In order to implement a proper help page this url will also prove a lot of use:
http://blogs.msdn.com/b/yaohuang1/archive/2012/12/10/asp-net-web-api-help-page-part-3-advanced-help-page-customizations.aspx
Below is my very basic implementation which lists parameter name and source
<h2 id="@Model.Key.ControllerName">@Model.Key.ControllerName</h2>
@if (!String.IsNullOrEmpty(controllerDocumentation))
{
<p>@controllerDocumentation</p>
}
<table class="help-page-table">
<thead>
<tr>
<th>API</th>
<th>Description</th>
<th>Params</th>
</tr>
</thead>
<tbody>
@foreach (var api in Model)
{
<tr>
<td class="api-name"><a href="@Url.Action("Api", "Help", new { apiId = api.GetFriendlyId() })">@api.HttpMethod.Method @api.RelativePath</a></td>
<td class="api-documentation">
@if (api.Documentation != null)
{
<p>@api.Documentation</p>
}
else
{
<p>No documentation available.</p>
}
</td>
<td class="api-documentation">
@foreach (var p in api.ParameterDescriptions)
{
@p.Name @:- @p.Source
}
</td>
</tr>
}
</tbody>
</table>