December 5, 2024
application-programming-interface-api

What is Web API?

WebAPI or Web API is the application programming interface (API) for both the web server and web browser. It provides theories, procedures and protocols to help the communication between different computer software’s. This article describes basic overview of ASP.NET web api, when to use asp.net web api, advantage of asp.net web. Summary of the article:

  • What is ASP.NET Web API?
  • Features of Web API
  • Why we should use Web API?
  • Types of Web API
  • Difference between WCF and ASP.NET Web API
web api, webapi

What is ASP.NET Web API?
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a verity of clients such traditional desktop applications, browsers, mobile devices, tablets. It is an ideal platform for building RESTful applications on the .NET Framework. WebAPI can return data based on media type. By default it provides JSON and XML based data.

Features of Web API
The web api has the following features:

  • It supports convention-based CRUD operations
  • By default the response format is JSON and XML, but we can change it to other format
  • It supports oData
  • It supports Self-host or IIS host
  • It supports MVC features (controllers, action results, routing, filter, model binders, IOC container or dependency injection)

Why we should use Web API?
The advantages of web api is good. We should use web api for the following reasons:

  • It is open source
  • It is architecture is light weight
  • It is good for devices which have limited bandwidth (smart phones)
  • If don’t need SOAP but want to use web service then it the best
  • It doesn’t have boring and huge configuration like WCF REST service
  • It is based on HTTP. That’s why it is easy to define, expose and consume in a REST-full way

Types of Web API
API is divided into following category:

  • Web service APIs
    This type of APIs can be accessed by URL. Here HTTP is used to exchange the information.
  • Library-based APIs
    This type of API can be accessed when an application is reference the code of library and then can use the library functions to exchange the information.
  • Object remoting APIs
    This type of APIs use a remoting protocol, which works by implementing local proxy objects to represent the remote objects, and interacting with the local object.
  • Hardware APIs
    This type of APIs deals with the hardware on a device.

Difference between WCF and ASP.NET Web API
A comparison between ASP.NET Web API and WCF (web API vs ASP.NET Web API) is given bellow:
WCF

  1. WCF support numerous protocols
  2. Its implementation and configuration is complex
  3. It is not open source

ASP.NET Web API

  1. Web API only support HTTP protocol
  2. Its implementation and configuration is simple
  3. It is open source

That’s all about Web API.

Rashedul Alam

I am a software engineer/architect, technology enthusiast, technology coach, blogger, travel photographer. I like to share my knowledge and technical stuff with others.

View all posts by Rashedul Alam →

4 thoughts on “What is Web API?

Leave a Reply

Your email address will not be published. Required fields are marked *