Introduction
This article explains how the Web API works. Here you will see the application layer of the API, the MVC architecture and the Web API architecture.
Application layer
The Web API is a framework for building web services, these web services use the HTTP protocol. The Web API returns the data on request from the client, and it can be in the format XML or JSON.
Application Architecture

MVC architecture
The MVC architecture is the Model-View-Controller Pattern. It is used for isolating an application to simplify testing and the maintenance of the code of the application.
Model: Model is used for the data of the application and the objects of the business.
View: View is the presentation layer of the application.
Controller: Controller works for binding the Model and View together.

Web API Architecture
The Web API uses the HTTP protocol. The Web API routing works a bit differently compared to the way that it works in MVC. There is a minor difference between the MVC routing and Web API routing, In the Web API the selection of the action uses the HTTP method instead of the URI path. It uses the Routing table that defines the action to be called for which request. We need to specify the routing parameters in the webApiConfig.cs file.
- config.Routes.MapHttpRoute(
- name: "DefaultApi",
- routeTemplate: "api/{controller}/{id}",
- defaults: new { id = RouteParameter.Optional }
- );
Now we define the code to illustrate how the routing is configured by the action.
- config.Routes.MapHttpRoute(
- name: "DefaultApi",
- routeTemplate: "api/{controller}/{action}/{id}",
- defaults: new { id = RouteParameter.Optional }
- );
The following table describes the routing.

Humayun Kabir MamunPosted Dec 28, 2015, 1:38 AM
Nice...
Mukesh KumarPosted Oct 20, 2015, 12:52 AM
Good Job