Ravi Srivastava
Ravi Srivastava

Reputation: 21

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

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.

Upvotes: 1

Views: 7878

Answers (2)

William Cheng
William Cheng

Reputation: 10807

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

Upvotes: 2

xiang9428
xiang9428

Reputation: 34

First of all you have to host your web api application (for example Azure), then your window application can call it as a client.

Upvotes: 0

Related Questions