ASP WebAPI

By James Kenny
2 min read

Table of Contents

ASP Web API

ASP.NET Web API is a framework for building web APIs on top of the .NET Framework. Using ASP.NET Web API you can create a HTTP RESTful services.

HTTP is not just for serving up web pages. It is also a powerful platform for building APIs that expose services and data. HTTP is simple, flexible, and ubiquitous. Almost any platform that you can think of has an HTTP library, so HTTP services can reach a broad range of clients, including browsers, mobile devices, and traditional desktop applications.

Get Started

In Visual Studio create a new project and select "ASP.NET Web application" Under Web templates. (I'm using Visual studio 2015)

Create ASP Web API

On the ASP.NET template screen for .NET 4.6 Select "Web API" this will scaffold everything you need. So go ahead create your first project.

Once Visual Studio has created the project you will have 3 controllers AccountController, HomeController, ValuesController

WEBAPI Default Solution

ValuesController has already been created with sample code for the API.

Run the project in debug mode and in your browser Click the "API" option

http://localhost:*****/help

Will show a list of the API methods available.

With the values Controller we can see the break down of all the API Methods

http://localhost:*****/Help/Api/GET-api-Values

Will show you the break down of the method for Get, the parameters required and response.

Summary

This post covered the very basics of getting started with Web API in .net. We'll bring more posts that build on this post over the next few weeks.

Tagged in:

ASP, ASP Web API, API

Last Update: August 21, 2018

About the Author