Swagger: Visualizing your ASP.NET Core WEB API

There is a visualization tool that you can include in your ASP.NET Core Web API solution that can really help with development. It’s called Swagger. Here are the steps on how you can install and use it in your solution.


Step 1: Download from Nuget

  • Go to Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution
  • Browse for Swashbuckle
    Swashbuckle Nuget.PNG
    Package Manager for Solution
  • Once installed , wait for the Project References to load.
    Project References

Step 2: Update your Startup Class

Add the following lines in the Configure method of the Startup class.

Swashbuckle Configure.png
Configure Method in Startup.cs

Step 3: Run your project

  • Run your project and access the following url:
    • <project url>/swagger/ui/index.html
  • From there you can now click on your controller name and see the methods available
Swashbuckle Values 1.png
Available methods for Values controller

Step 4: Test out your API

  • If we try clicking in POST, details related to that method are available

Swashbuckle Values 2.png

  • To test your API, click Try it out!

I have found this tool extremely useful in developing Web APIs since it immediately displays the model I need for a certain API method.

I hope this helps you in your development.

Credits to http://swagger.io/ for the tool.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s