Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between ASP.NET MVC 4 Web Api and REST classic services

I saw that ASP.Net MVC4 WebApi exposes services as a Rest ones.

But what is actually the difference between normal Rest and ASP.Net MVC4 WebApi?

like image 873
Night Walker Avatar asked Mar 13 '12 13:03

Night Walker


People also ask

What is the difference between MVC and REST API?

MVC is about how the inner side of your app works. REST is about how your app "talks" with other apps. You can combine them. MVC is a design pattern for creating a separation of concerns and avoiding tightly coupled data, business, and presentation logic.

What is the difference between ASP NET MVC and Web API?

Asp.Net MVC is used to create web applications that return both views and data but Asp.Net Web API is used to create full-blown HTTP services with an easy and simple way that returns only data, not view.

What is difference between Web API and REST service?

As Web APIs are lightweight architecture, they are designed for gadgets constrained to devices like smartphones. In contrast, REST APIs send and receive data over systems making it a complex architecture.


2 Answers

I'm not sure what you mean by normal Rest.

REST is a paradigm.

HTTP is a protocol that follows that paradigm.

ASP.NET Web API allows developers to write ASP.NET applications that can be accessed via HTTP and adhere to the REST paradigm. While you could create a REST API without Web API, Web API provides a ton of features that will remove a lot of the pain associated with creating a truly RESTful API in ASP.NET.

apigee has many great resources for REST API best practicies.

like image 79
Omar Avatar answered Sep 30 '22 17:09

Omar


Are you asking about the general REST standard or the way that REST has been done traditionally on the Microsoft platform prior to the MVC4 Web API? I am thinking you are approaching this as the second one.

The updated approach in MVC4 gives you more REST capabilities without the WCF model. Here is a recent post on the subject: http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx.

like image 38
Ben Cline Avatar answered Sep 30 '22 16:09

Ben Cline