How to add Help Pages to ASP.NET Web API Services – Dan Wahlin

Home > Blogs > Developer Visual Studio / ASP.NET > How to add Help Pages to ASP.NET Web API Services – Dan Wahlin

How to add Help Pages to ASP.NET Web API Services – Dan Wahlin

Like This Blog 0 Dan Wahlin
Added by November 19, 2012

In a previous post I discussed the fundamentals of using the new ASP.NET Web API to expose JSON data to Ajax-enabled clients. One of the challenges with RESTful services exposed by ASP.NET Web API, Node.js, WCF, and others is that consumers of the service don't know what to expect from it unless documentation is provided or unless they manually call the service and analyze the data that's returned. Fortunately, Microsoft has added a new help page feature to make it much easier to understand what data a service provides.

To get started adding help pages into ASP.NET Web API projects you can install the latest  Visual Studio Fall 2012 Update Microsoft ASP.NET – Fall 2012 Update and create a new Web API project or use the help page Nuget package to add the functionality into an existing project:

MVCApplication - How to add Help Pages to ASP.NET Web API Services by Dan Wahlin

For now you'll have to select "Include Prerelease" from the dropdown in order to see it in the NuGet Package Manager but that'll change in the near future as it moves into a final release.

After adding help page functionality into an ASP.NET MVC project (note that you can use ASP.NET Web API and the help page feature in ASP.NET Web Forms projects as well), you'll see an Areas folder in your project that has a subfolder named HelpPage:

Areas HelpPage - How to add Help Pages to ASP.NET Web API Services by Dan Wahlin

Once your ASP.NET Web API functionality is complete you can browse to your site and add "help" on the end of the URL. For example: http://localhost:8080/help. The help path can be changed in the HelpPageAreaRegistration.cs file shown above if you'd like.

After going to the URL a help page that documents your Web API functionality will automatically appear and users can drill down into it to get additional details. A few examples of the default help page functionality are shown next:

Web API Functionality - How to add Help Pages to ASP.NET Web API Services by Dan Wahlin

 

Web API Functionality - How to add Help Pages to ASP.NET Web API Services by Dan Wahlin

The new ASP.NET Web API help page feature adds much needed functionality into ASP.NET MVC or ASP.NET Web Forms projects and makes your services much more discoverable. In addition to showing the default documentation, you can also tweak it to show custom samples. Additional details can be found at ASP.NET Web API Help Page Part 2: Providing custom samples on the Help Page.

 

Enjoy!
Dan Wahlin Microsoft MVP
.NET Developer Instructor
Interface Technical Training

Videos You May Like

Agile Methodology in Project Management

0 149 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

Using Navigation Controls in a Collaboration Site in SharePoint

0 330 1

In this SharePoint training video, I want to talk about the Navigation Controls in SharePoint. They tend to fall into two kind of different categories; one with the navigation controls in a typical Collaboration Site such as a Team Site or a Project Site. These are Sites that are based on the Team Site Template … Continue reading Using Navigation Controls in a Collaboration Site in SharePoint

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 592 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.