Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebApi Help Page Description

What populates the Webapi method's description on the helper page and the introduction paragraph?

enter image description here

like image 851
heymega Avatar asked Jun 18 '14 11:06

heymega


People also ask

How do I add a description to Web API?

In Solution Explorer, right-click the project and select Properties. Select the Build page. Under Output, check XML documentation file. In the edit box, type “App_Data/XmlDocument.

How do I use Microsoft ASP.NET Web API Helppage?

Creating API Help PagesInstall ASP.NET and Web Tools 2012.2 Update. This update integrates help pages into the Web API project template. Next, create a new ASP.NET MVC 4 project and select the Web API project template. The project template creates an example API controller named ValuesController .

Which one from the following will run on top of ASP.NET Web API help pages?

NuGet packages (36) A simple Test Client built on top of ASP.NET Web API Help Page.

How do you explain Web API?

Web API is an API as the name suggests, it can be accessed over the web using the HTTP protocol. It is a framework that helps you to create and develop HTTP based RESTFUL services. The web API can be developed by using different technologies such as java, ASP.NET, etc.


2 Answers

To view the description you need to follow this :

  1. Every action in your Customer controller must have a XML documentation
  2. Open the properties of the project that contains your controllers and enable XML documenation like this : enter image description here
  3. In the Register method for HelpPageConfig class ( Areas/HelpPage/App_Start/HelpPageConfig.cs) uncomment the line 19 and don't forget to change the file path like this :

    config.SetDocumentationProvider(new XmlDocumentationProvider(     HttpContext.Current.Server.MapPath("~/App_Data/MvcApplication4.XML")) ); 

This all you must do. Last thing is to include the file created in App_Data in your project so the file will be deployed in production.

like image 42
CodeNotFound Avatar answered Sep 21 '22 19:09

CodeNotFound


According to this article you can use XML documentation comments to create the documentation. To enable this feature, open the file Areas/HelpPage/App_Start/HelpPageConfig.cs and uncomment the following line:

config.SetDocumentationProvider(new XmlDocumentationProvider(     HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml"))); 

Now enable XML documentation. In Solution Explorer, right-click the project and select Properties. Select the Build page.

Under Output, check XML documentation file. In the edit box, type “App_Data/XmlDocument.xml”.

Add some documentation comments to the controller methods. For example:

/// <summary> /// Gets some very important data from the server. /// </summary> public IEnumerable<string> Get() {     return new string[] { "value1", "value2" }; }  /// <summary> /// Looks up some data by ID. /// </summary> /// <param name="id">The ID of the data.</param> public string Get(int id) {     return "value"; } 
like image 76
Md Nazmoon Noor Avatar answered Sep 20 '22 19:09

Md Nazmoon Noor