asp.net-web-api – Document and test methods of an ASP.NET Core Web API

Question:

Is there any tool capable of listing the methods of a Web API and that it is possible to test them?

I've already researched this on the site and I haven't found specific solutions for a Web API that would meet what I need.

Answer:

Yes there is.

A widely used tool for what you're asking for is Swagger.

What is Swagger?

Swagger is a project composed of some tools that help the developer of REST APIs in some tasks such as:

  • API modeling
  • Generation of (readable) API documentation
  • Client and Server code generation, supporting several programming languages

How to configure?

There's a very interesting article that explains exactly what you should do to configure Swagger for your Web API.

ASP.NET Core: Documenting an API with the Swagger Framework

Basically what you should do is configure Swagger and then document your Controllers and your Web API object classes through comments explaining what each one does.

Once that's done, Swagger does the magic for you and it's possible to visualize and test its methods through a generated web page.

Scroll to Top