This article is a mirror article of machine translation, please click here to jump to the original article.

View: 20232|Reply: 0

[WebAPI] webAPI automatically generates help documentation

[Copy link]
Posted on 10/6/2016 3:08:16 PM | | | |
Previously, I used webapi to provide interfaces in the project, and found that in the project there is automatic generation of help documents according to webapi methods and comments, and you can also test webapi methods, which are very powerful, and now I will share them with you.
Take a look at the generated webapi documentation first.
1. The following figure shows the top page of the generation help document, where Values is the controller, and the list below the API shows the http method (Get, POST, etc.), the action of the request, and the description of the method.
2. Click the link in the red box to open the details page of the API method, as shown in the figure below.
3. Click Test API to open the following page

4. Enter the parameters, click the Send button, open the following page, and you can see the return value.

The steps to set it up are as follows:
Development environment VS2012 + MVC4 + WEB API
1. Reference the Web API Test Client through NuGet

Referencing the DLL will generate a file like this:
This is our help documentation interface


2. Make the following settings in the project properties, check the XMl document file, and set the path
3. Create a XmlDocument.xml under the App_Data folder of the project
4. Open the AreasHelpPageApp_StartHelpPageConfig.cs file and cancel the following code comments

Run the project, open the http://localhost:3619/Help, and you can see the automatically generated API document, which is an image of the article

Project Download:

WebAPIHelper.part2.rar (893.15 KB, Number of downloads: 1) WebAPIHelper.part1.rar (1.5 MB, Number of downloads: 0)




Previous:ss-panel v3 running python servers.py error
Next:Block right-click, F12, and avoid viewing the source code
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com