Wednesday, August 3, 2016

What is Web API and Why to Use it ?













Asp.Net Web API may be a framework for building protocol services which will be consumed by a broad vary of purchasers as well as browsers, mobiles, iphone and tablets. it's terribly just like ASP.NET MVC since it contains the MVC options comparable to routing, controllers, action results, filter, model binders, IOC instrumentality or dependency injection. however it's not a section of the MVC Framework. it's a section of the core ASP.NET platform and might be used with MVC and alternative varieties of net applications like Asp.Net WebForms. It also can be used as AN complete net services application.

Why Asp.Net Web API (Web API) ?

Today, a web-based application isn't enough to achieve it's customers. individuals area unit terribly sensible, they're exploitation iphone, mobile, tablets etc. devices in its lifestyle. These devices even have a great deal of apps for creating the life straightforward. Actually, we tend to area unit moving from the net towards apps world.

So, if you prefer to show your service information to the browsers and moreover as of these trendy devices apps in quick and easy approach, you ought to have AN API that is compatible with browsers and every one these devices.

For example twitter,facebook and Google API for the net application and phone apps.

Web API is that the nice framework for exposing your information and repair to different-different devices. furthermore net API is open supply a perfect platform for building REST-ful services over the .NET Framework. not like WCF Rest service, it use the complete featues of protocol (like URIs, request/response headers, caching, versioning, numerous content formats) and you do not have to be compelled to outline any additional config settings for various devices not like WCF Rest service.

Web API Options:

1. It supports convention-based CRUD Actions since it works with protocol verbs GET,POST,PUT and DELETE.

2. Responses have AN settle for header and protocol standing code.

3. Responses area unit formatted by net API’s MediaTypeFormatter into JSON, XML or no matter format you wish to feature as a MediaTypeFormatter.

4. it should accepts and generates the content which can not be object headed like pictures, PDF files etc.
5. it's automatic support for OData. thence by inserting the new [Queryable] attribute on a controller technique that returns IQueryable, purchasers will use the strategy for OData question composition.
6. It will be hosted with within the applicaion or on IIS.

7. It conjointly supports the MVC options comparable to routing, controllers, action results, filter, model binders, IOC instrumentality or dependency injection that produces it a lot of easy and sturdy.

Why to decide on Web API ?

1. If would like we'd like we want an online Service and don’t need SOAP, then ASP.Net net API is most suitable option.

2. it's accustomed build easy, non-SOAP-based protocol Services on high of existing WCF message pipeline.

3. It does not have tedious and intensive configuration like WCF REST service.

4. easy service creation with net API. With WCF REST Services, service creation is tough.

5. it's solely supported protocol and simple to outline, expose and consume in a very REST-ful approach.

6. it's light-weight weight design and smart for devices that have restricted information measure like sensible phones.

7. it's open supply.

What does one think?

I hope you've got enjoyed the article and would able to have a transparent image concerning net API. i might prefer to have feedback from my journal readers. Your valuable feedback, question, or comments concerning this text area unit continuously welcome.

Share along with your friends!...