ASP.NET Web API
The ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework. (Reference from the MSDN.)
SOAP
The Simple Object Access Protocol (SOAP) is a XML based communication protocol for exchanging information over HTTP. It is platform independent as well as language independent.
REST
REST is a representable state transfer and it uses standard Hypertext Transfer Protocol (HTTP) actions for CRUD operations, like GET, POST, PUT and DELETE. It supports any text format including XML.
HTTP Methods
The following are the HTTP methods verbs:
- GET: Read (or) Retrieve
- POST: Create
- PUT: Update
- DELETE: Delete
|
S. No |
Methods |
Description |
|
1 |
GET |
Retrieves a representation of a resource. |
|
2 |
POST |
Creates a resource. |
|
3 |
PUT |
Updates a representation of the original resource. |
|
4 |
DELETE |
Deletes a resource. |
Procedure
1. Open Visual Studio.
3. You can select an installed template under the Visual C# and select Web option. Then select ASP.NET Web Application. Then enter the application name and location then click the OK button.

- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace EmployeeApps.Models
- {
- public class Employee
- {
- public int EmployeeId { get; set; }
- public string EmployeeName { get; set; }
- public string EmployeeDepartment { get; set; }
- public decimal EmployeeSalary { get; set; }
- public string EmployeeLocation { get; set; }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Web.Http;
- using EmployeeApps.Models;
- namespace EmployeeApps.Controllers
- {
- public class EmployeeController : ApiController
- {
- Employee[] employee = new Employee[]
- {
- new Employee{ EmployeeId=100, EmployeeName="Santhakumar", EmployeeDepartment="DOTNET", EmployeeSalary=10000.00m, EmployeeLocation="Chennai"},
- new Employee{ EmployeeId=101, EmployeeName="Moorty", EmployeeDepartment="DOTNET", EmployeeSalary=30000.00m, EmployeeLocation="Chennai"},
- new Employee{ EmployeeId=102, EmployeeName="Rajkumar", EmployeeDepartment="DOTNET", EmployeeSalary=10000.00m, EmployeeLocation="Chennai"},
- new Employee{ EmployeeId=103, EmployeeName="Saktikumar", EmployeeDepartment="DOTNET", EmployeeSalary=50000.00m, EmployeeLocation="Chennai"},
- new Employee{ EmployeeId=104, EmployeeName="Sathikumar", EmployeeDepartment="DOTNET", EmployeeSalary=10000.00m, EmployeeLocation="Chennai"},
- new Employee{ EmployeeId=105, EmployeeName="Praveen", EmployeeDepartment="DOTNET", EmployeeSalary=20000.00m, EmployeeLocation="Chennai"},
- };
- public IEnumerable<Employee> GetAllEmployeeDetails()
- {
- return employee;
- }
- }
- }
- public static void Register(HttpConfiguration config)
- {
- // Web API configuration and services
- // Web API routes
- config.MapHttpAttributeRoutes();
- config.Routes.MapHttpRoute(
- name: "DefaultApi",
- routeTemplate: "api/{controller}/{id}",
- defaults: new { id = RouteParameter.Optional }
- );
- }
Output

Conclusion
This article helps you to understand the ASP.NET Web API and its implementation in Visual Studio 2013.

sudarshan dhongadePosted Aug 30, 2019, 1:55 AM
Upload the code so that it will be helpfull for beginners
SubashPosted Mar 14, 2017, 9:36 PM
Thanks for sharing very nice
Humayun Kabir MamunPosted Dec 14, 2015, 1:24 AM
Nice...
Ankur MistryPosted Dec 13, 2015, 1:52 PM
thanks for sharing
Santhakumar MunuswamyPosted Dec 13, 2015, 11:34 AM
Thank for nice article. if you can upload code it will be helpful for the beginner