ASP .NET 5 WEB API creating help page
Asked Answered
S

1

6

I just got started working on ASP.NET 5. I want to have a help page for my methods, I have seen few examples for creating help pages but most of them are MVC specific. I have gone through Microsoft.AspNet.WebApi.HelpPage package, it creates an Area for help page but I am not using MVC pattern.

Any suggestions how can I create help page other than this area approach?

Sumatra answered 1/12, 2015 at 8:22 Comment(1)
is there anything else you need, could you mark my answer below as correct?Cuspidate
C
5

I would suggest looking at Swagger and SwaggerUI. Swagger is an open standard, using JSON to document an API, used by the likes of PayPal and Microsoft (check out Logic apps in the azure portal).

There are some open source implementations for .Net (both of which I have used), which will self document your API, just by adding the NuGet packages to your project and a little bit of configuration:

Swashbuckle is the original project and Ahoy is the new version targeting ASPNET5. When downloading the package from NuGet you will still get Swashbuckle, just make sure you tick "include pre-release", and if you need any documentation look at the original GitHub project.

SwaggerUI (which is also included in Swashbuckle) adds an interface which you can use to navigate and test your API, by default this is available from "/swagger/ui" when your project is running.

Here is a sample repo in GitHub I put together showing how it can be used: https://github.com/mattridgway/ASPNET5-SwaggerUI

Cuspidate answered 8/2, 2016 at 22:6 Comment(1)
Although Swagger is amazing, it won't work with customizations of the WebAPI without much, much adaptation work, and not everything can be adapted there, sadly. The providers from the WebAPI are fully customizable, so this does not provide a full replacement for the HelpPage package.Burnie

© 2022 - 2024 — McMap. All rights reserved.