A Practical Guide to ASP.NET Web API

By | February 17, 2014

Microsoft ASP.NET Web API framework is the best choice for developing HTTP services in more simpler way. It enables us to reach more wider ranger of clients such as browsers as well as mobile devices.In one of my previous web development tutorial about building RESTful service, I explained that the purpose of HTTP is not just acting as a transport layer (for example, in case of SOAP-based WCF service). However, its a very mature platform for developing Web APIs and utilizing its old simple concepts such as HTTP methods, HTTP status codes and URIs etc.


Note: You can download a PDF version of the same “A Practical Guide to ASP.NET Web API” here.


So, we can say that using ASP.NET Web API, we can create HTTP services

  • those are non-SOAP based like plain XML or JSON string.
  • using full features of HTTP.
  • reaching broader range of clients (browsers and mobile devices).

You can find recent ASP.NET Web API Tutorial for Creating your First SPA Application using AngularJS and Web API having all CRUD Operations.

Following is the typical ASP.NET Web API processing architecture.

ASP.NET Web API Service
You are designing an ASP.NET Web API application. You need to select an HTTP verb to allow blog administrators to moderate a comment. Which HTTP verb should you use?

  • A. GET
  • B. POST
  • C. DELETE
  • D. PUT

To further test your ASP.NET Web API skill, Take a Complete FREE Online Test or MCSD Practice Exam: 70-486 (Developing ASP.NET MVC Web Applications). Simply Click Here.

 Correct Answer: D

Lets move forward to implement all the above mentioned related features step by step.

Chapter 1:- Developing your first ASP.NET Web API service
In chapter 1, we will be creating a simple HTTP service using Web API. A step by step approach is used while developing the service and getting results as:

  • Creating a Web API Project in Visual Studio
  • Preparing a Domain Model
  • Adding Controller
  • Finally testing results in browser.

Chapter 2:- Performing CRUD operations using ASP.NET Web API service – Part 1
As chapter 1 only focuses getting records using HTTP GET verb only, this chapter provides complete detail understanding of all CRUD (Create, Retrieve, Update, Delete) operations using Web API. Discussion about all related HTTP verbs i.e. GET, PUT, POST, DELETE is provided.

Chapter 3:- Performing CRUD operations using ASP.NET Web API service – Part 2
As we have already developed Web API service in previous chapter, here in this chapter, we will be consuming already created HTTP service using jQuery. Complete code snippet of jQuery for consuming a Web API service is given with detailed understanding of jQuery AJAX call.

Chapter 4:- What’s new in ASP.NET Web API 2
Web API version 2 is released and this chapter briefly overview the top new features of ASP.NET Web API i.e.

  • Attribute Routing
  • Cross Origin Resource Sharing
  • Open Web Interface for .NET
  • IHttpActionResult
  • Web API OData
Chapter 5:- Model Validation in ASP.NET
Model in MVC framework is a representation of data structure. This Web API Tutorial focuses to understand and implement the data annotation technique for applying validation on a model class for an ASP.NET Web API application.

Chapter 6:- Exception Handling in ASP.NET Web API – Part 1
This chapter discusses about Exception Handling in ASP.NET Web API service. Instead of returning a generic status code i.e. 500 (Internal Server Error), a valid and meaning result should be sent back to client using HttpResponseException type.

Chapter 7:- Exception Handling in ASP.NET Web API – Part 2
To achieve the same purpose, as discussed in previous chapter, for more advanced scenarios: Web API provide Exception Fitlers and focus of the chapter is how to create an Exception Filter and return meaningful response.

Chapter 8:- ASP.NET Web API OData 5.3
Discussing in detail about features of Microsoft ASP.NET Web API OData 5.3 and 5.3.1 beta including:

  • Open Entity Type Support
  • Major Bug Fixes
  • Dynamic Collection Property in Open Type
  • More about flexibility to use $levels and $expand queries
  • Utilizing OData Core Libraries.

Extras:- Top 10 ASP.NET Web API Interview Questions
For a detailed and comprehensive list of Top 10 most important Interview Questions for Microsoft ASP.NET Web API that every Web Developer MUST Know.

Top 10 Interview Questions and Answers Series:

ASP.NET Jobs [Updated Daily]

Top ASP.NET MVC Jobs

Application Developer Journeyman Job
Source: CACI International
Details: ASP.NET MVC, Entity Framework (or other ORM), JavaScript, XML, JSON, Web API, and Powershell. Job Requisition Number:....  More
16 days ago

Reston, VA 07-July-2016

Application Developer Journeyman Job
Source: CACI International
Details: ASP.NET MVC, Entity Framework (or other ORM), JavaScript, XML, JSON, Web API, and Powershell. Job Requisition Number:....  More
16 days ago

Colorado Springs, CO 07-July-2016

Mid Level .Net Web Developer
Source: The Rock Creek Group
Details: You will be working on applications written using ASP.NET, MVC and SQL Server. We are looking for candidates within the local region....  More
9 hours ago

Washington, DC 20036 23-July-2016

Sitecore Developer- Open To Any Experience Level
Source: Rightpoint
Details: Experience with ASP.NET MVC and/or Web Forms. Software Development | Chicago, IL, United States....  More
18 hours ago

Chicago, IL 22-July-2016

Mid-Level ASP.NET / Front End Developer
Source: Indeed
Details: We're a small Pittsburgh based web development company looking for an additional developer to join our team. This position will have a chance to work on many  More
4 days ago

Pittsburgh, PA 18-July-2016

Sitecore Developer- Open To Any Experience Level
Source: Rightpoint
Details: Experience with ASP.NET MVC and/or Web Forms. Software Development | Dallas, TX, United States....  More
9 days ago

Dallas, TX 13-July-2016

Sitecore Developer- Open To Any Experience Level
Source: Rightpoint
Details: Experience with ASP.NET MVC and/or Web Forms. Software Development | Boston, MA, United States....  More
9 days ago

Boston, MA 13-July-2016

Sitecore Developer- Open To Any Experience Level
Source: Rightpoint
Details: Experience with ASP.NET MVC and/or Web Forms. Software Development | Atlanta, GA, United States....  More
9 days ago

Atlanta, GA 13-July-2016

Software Developer (Jr. level)
Source: Indeed
Details: O C#, ASP.NET, SQL Server, and SQL Server Integration Services requiredo ASP .NET MVC, Entity Framework, Silverlight, WCF and WCF Data Services preferred....  More
9 days ago

Portland, ME 13-July-2016

Junior Developer
Source: Addx
Details: Provide development and software support for several systems utilizing .NET, ASP.NET MVC 5, SharePoint, C#, Visual Basic, PHP, SQL, JQuery, JavaScript, Ajax,...  More
2 days ago

Egg Harbor Township, NJ 20-July-2016

Systems Analyst / Programmer Developer, Level 2
Source: Sterling National Bank
Details: Experience and knowledge of C#, VB.NET, ASP.NET MVC, JavaScript, jQuery, HTML5, CSS3, WCF, LINQ, SQL Server, Visual Studio, REST and SOAP APIs....  More
11 days ago

Yonkers, NY 12-July-2016

Junior .NET Developer
Source: Indigo Beam LLC
Details: ASP.NET MVC, Entity Framework. Programming and Markup Languages:....  More
3 days ago

Houston, TX 20-July-2016

Mid-Level .NET Developer
Source: Indeed
Details: Microsoft Asp.Net MVC and Web Forms (AJAX). Our Company builds technology solutions to meet the ever-changing needs of our clients....  More
11 days ago

Lindenhurst, NY 11757 11-July-2016

Lead .NET Analyst/Developer
Source: DISH
Details: Solid understanding of design patterns Experience with Web technologies such as Asp.Net Web forms, Asp.Net MVC, HTML 5, CSS, JavaScript, JQuery, AngularJS,...  More
10 days ago

Englewood, CO 12-July-2016

Mid-Level .NET Developer
Source: ActioNet, Inc.
Details: The candidate must have a solid understanding of ASP.NET MVC, HTML, JQuery, WCF, and Object Oriented Programing principles....  More
14 days ago

Washington, DC 20024 08-July-2016

Senior Software Engineer
Source: Posh Technologies
Details: Visual Studio 2013+, C#, ASP.NET MVC 5 and Web API 2. 5+ years of working experience with C#, ASP.Net MVC, SQL Server, JavaScript....  More
6 days ago

Redmond, WA 17-July-2016

Application Developer
Source: Russell Investments
Details: C#, ASP.NET, MVC. This position will be responsible for custom application development, business line integration, and industry best practice....  More
30+ days ago

Seattle, WA 02-June-2016

Junior .NET Application Developer
Source: FEi Systems, Inc.
Details: Knowledge of ASP.NET MVC. We are seeking a junior level .NET Developer to join our team....  More
7 days ago

Columbia, MD 15-July-2016

Junior Web Application Developer
Source: LBMC, PC
Details: 1 to 5 years of experience with Asp.Net or Asp.Net MVC. The candidate will work with a variety of technologies such as jQuery, Angular.js, Asp.Net MVC, REST,...  More
8 days ago

Nashville, TN 14-July-2016

Junior Developer
Source: Indeed
Details: Full Stack ASP.NET, MVC Developer. Proficient in ASP.NET C#, MVC, Entity Frameworks, SQL Server. Lead role of the company’s internal order management system....  More
8 days ago

Huntington Beach, CA 14-July-2016

Junior .Net Developer
Source: Willis Towers Watson
Details: MVC experience preferred. You will also be responsible, to some extent, to maintain and customize our pre-BenefitConnect software, written in Visual Basic 6,...  More
10 days ago

Washington, DC 12-July-2016

Lead .net Developer
Source: Houghton Mifflin Harcourt
Details: Highly experienced with C#, ASP.NET, JQuery, JQuery Mobile, CSS3 HTML5, and ASP.NET MVC. Job Requisition ID :....  More
15 days ago

Boston, MA 02116 08-July-2016

SQL Developer/Administrator
Source: Hewlett Packard Enterprise
Details: Knowledge of Microsoft ASP 4.5 Framework. Knowledge of using Microsoft technologies (ASP .NET, MVC web services, REST, Web API, WPF)....  More
1 day ago

El Paso, TX 22-July-2016

Web Application / Ember.js Developer
Source: BitTitan
Details: Experience with at least one backend MVC framework such as .NET MVC, Rails, Django, Symfony2, Laravel, etc. Experience with ASP.NET MVC and Web Forms....  More
28 days ago

Kirkland, WA 25-June-2016

Application Developer- ITS Marketing
Source: Dick's Sporting Goods
Details: .Net Framework - preferrably C#ASP.Net Web Forms, ASP.Net MVC, ASP.Net Web APIWCF and Windows FormsUnderstanding of Service Oreiented ArchitectureQueries and...  More
30+ days ago

Pittsburgh, PA 02-June-2016
Category: ASP.NET ASP.NET Web API Tags:

About IMRAN ABDUL GHANI

Imran Abdul Ghani is working as Software Developer(Senior) with extensive knowledge in Web development technologies especially C#, ASP.NET, MVC, WCF, Web API, ADO.NET Entity Framework, jQuery etc. He has several years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET (MCSD.NET) since 2005. You can reach his blogging at www.webdevelopmenthelp.net, www.topwcftutorials.net, and www.sharepointfordummies.net.