Swagger integration in ASP.NET Web API project

Swagger integration in ASP.NET Web API project 2018-06-24

No permission to download
Introduction

When you create a new ASP.NET Web API project, you need to present your APIs in a simple and comprehensive way? You can use Swagger.

“Swagger is a simple yet powerful representation of your RESTful API. With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger in almost every modern programming language and deployment environment. With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability.”

-swagger.io
Add Swagger to Web API Project

To add Swagger to an ASP.NET Web API, we will install an open source project called Swashbuckle via NuGet.

swagger3.JPG


When we install the package, a new config file was added: SwaggerConfig as mentioned in the picture below:
swaggerConfig.JPG

Swagger configuration

In the configuration file added, we find the minimum configuration needed to enable Swagger and Swagger UI :

swaggerConfigFile.JPG


Now, when we start a new debugging session, we get the URI of our API and we navigate to Swagger: http://localhost:[PORT_NUM]/swagger


And if we want to display our APIs :
SwaggerDisplay.JPG
Author
AWS
Downloads
2
Views
794
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from AWS

Back
Top