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
- Once installed , wait for the Project References to load.
Step 2: Update your Startup Class
Add the following lines in the Configure method of the Startup class.
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
Step 4: Test out your API
- If we try clicking in POST, details related to that method are available
- 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.