Working with API Help Page Controller Action Description


Working with API Help Page Controller Action Description

In this tutorial we are going to see how we can enable the API descriptions for a better understanding of how our API controller works and what exactly it is supposed to do. It is recommended to give the summary and parameter lists and a bit of an introduction to the service whenever you write any API services. Here I am going to use create a Web API in Visual Studio 2019.

We will change the code as follows:

1. Go to Areas\HelpPage\App_Start and click on the file HelpPageConfig.cs.Uncomment the following line from the static function Register.
config.SetDocumentationProvider(new XmlDocumentationProvider
(HttpContext.Current.Server.MapPath("App_Data/XmlDocument.xml")));

2. Right click on your project and go to properties, then click on Build.
3. Go to Output section and click on XML documentation file and then type App_Data/XmlDocument.xml in the given text box.
4. Save and build your project.
5. Add summary on every action method.


#Web #API #Restful #Service #RestAPI #core #API2

إرسال تعليق

أحدث أقدم