14

I currently have a MVC project in ASP.Net that is using a WebApi. Most of the code for the controllers is written in c#. I'd like to automatically generate a description of API calls including:

1.) The url of the page/endpoint

2.) Description of what endpoint/page does

3.) List of arguments with descriptions and datatypes.

4.) HTTP Verb (get, post, put, delete)

5.) The permissions required for the page

The description will have to be written manually.

I've read quite a few other articles that result in the individual using a 3rd party application like Swagger. Is there something built in to ASP.Net to help with this? If I wanted to try to generate documentation myself (without using 3rd party software), how would I get started on creating such documentation?

I've spent a fair amount of time googling various queries and can't seem to find an answer.

Edit: What's the benefit of using Swagger over ASP.Net help pages in my case?

7
  • 1
    Something like this? asp.net/web-api/overview/getting-started-with-aspnet-web-api/… Commented Jun 12, 2015 at 14:40
  • That looks like it could be what I was looking for. I'll take a look at it, then get back. Thanks for the quick reply. Commented Jun 12, 2015 at 14:42
  • 2
    Swagger is even used by Azure API Apps, so you should probably prefer it. You can use Swashbuckle to generate the documentation Commented Jun 12, 2015 at 14:49
  • @PanagiotisKanavos What's the benefit of using Swagger over ASP.Net in my case? Commented Jun 12, 2015 at 15:46
  • 1
    If your swagger api consumer is something like SwaggerUI, it would allow users to try out the api calls right from the documentation Commented Jun 12, 2015 at 15:50

2 Answers 2

21

As an alternative to Swagger you can make use of the 'Help Pages' for ASP.NET Web API.

Entries within this documentation are generated automatically and will contain information such as:

  • Relative URI

  • HTTP Method

  • Sample Request/Response data

  • A description of the API purpose (derived from XML comments)

If using a third party component is possible then I would recommend you use Swagger (Use the Swashbuckle NuGet package) to achieve API documentation.

Sign up to request clarification or add additional context in comments.

1 Comment

The downside of using Help Pages is that it adds a ton of stuff to your project. The downside of Swagger/Swashbuckle is that it doesn't support multiple Web API actions at the same URL path but with different parameters.
5

Swagger does not just list your api uris. Users actually try them out and see the response

Swagger has tools to create the documentation before you implement it.

It can also add description using the comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.