Creating a Web Service for the Northwind Database
Learn about using content negotiation to return data in various formats in Web API controllers, contrasting with MVC controllers.
We'll cover the following
Unlike MVC controllers, Web API controllers do not call Razor views to return HTML responses for website visitors to see in browsers. Instead, they use content negotiation with the client application that made the HTTP request to return data in formats such as XML
, JSON
, or X-WWW-FORM-URLENCODED
in their HTTP response.
The client application must then deserialize the data from the negotiated format. The most used format for modern web services is JavaScript Object Notation (JSON) because it is compact and works natively with JavaScript in a browser when building Single-Page Applications (SPAs) with client-side technologies like Angular, React, and Vue.
Get hands-on with 1400+ tech skills courses.