When using WEBAPI to provide rest services, a common operation is to test the interface. The ASP. NET Webapi framework itself does not provide this interface, but because it provides a standard rest service, it is very convenient to use some third-party tools.
I used to test with Chrome's postman plugin, which can be used to simulate various HTTP request operations. Although this tool is also good, but because it is a common tool, when using it to build HTTP headers, and according to the specific API to assemble the message body, this is a more troublesome thing.
Today, when I was hanging out on the internet, I found a more useful test tool, Swagger-ui, which provides a very friendly test interface for the rest interface:
Not only can you provide a list of interfaces, but also read the parameters list of the interface and provide a friendly configuration interface:
Interface description, parameter description, parameter types can all come out, very friendly, even the parameters of the various fields of the comments can be marked out, is basically a very friendly help document.
More examples can refer to its official demo:http://petstore.swagger.io/. Using it to test is very simple, directly input parameters on the line, without the laborious construction of various URLs and messages, more convenient than postman.
Due to space limitations, this article is only a few simple introductions to Swagger-ui, and the next article details how to integrate Swagger-ui into WEBAPI.
Add test page to Webapi's Rest Interface Service (i)