How to consume swagger web api in window application in c#

c#-4.0swaggerswagger-2.0swagger-editorswagger-ui

I have an Web API URL which display the API information in swagger UI format. I want to generate client libraries from Swagger codegen using Web API URL.

Please let me know how I can pass username and password when we are importing the URL in https://editor.swagger.io. In my case when I am importing the url then it's show authentication error because this url need username and password for authentication. As per Swagger example when i am trying same thing with this url "http://petstore.swagger.io/v2/swagger.json" it's validated successfully then I am able to generate the Client code same thing i want to do with my url.

Best Answer

You can download the Swagger/OpenAPI spec via browser by supplying the correct username and password. Then in https://editor.swagger.io, import from the local file, and generate the API clients or server stubs.

https://editor.swagger.io uses https://generator.swagger.io to generate API clients or server stubs and generator.swagger.io is also free and open source: https://github.com/swagger-api/swagger-codegen

Related Topic