ASP .NET Web API – Creating and Consuming a Web API (C #)

In this article I will show you how to create a Web API and how to consume the REST service created on the .NET platform using the C # language.
The ASP .NET Web API is a framework for building HTTP services on the .Net platform. A Web API can be viewed as a set of web-exposed (HTTP) services to integrate your application with various types of clients (browsers, tablets, smartphones, etc.) who want to use the services.

These services are used as HTTP requests and return a response in a specific format such as XML, JSON, or in a format you can define. (JSON is default). This response can be information from a data repository, the return of an operation, etc.

The client can be a web page (Javascript with Ajax, CSS and HTML), a desktop application, a mobile application, etc. Web API examples include the Facebook and Twitter Web APIs.
ASP .Net Web API was released with ASP.NET MVC 4 and is already installed on VS 2012, VS 2013 and VS 2015.

Using the ASP.NET Web API we can create non-SOAP-based services, such as XML or simple character JSON strings, or in a defined format. With the following advantages:

Create services using HTTP resources;
Expose services to a range of customers such as browsers, mobile devices, smartphones, tables, etc .;
Work using standard HTTP verbs, such as GET, POST, PUT, DELETE, etc., for all CRUD operations;
Give full support for routing;
Give answers in JSON or XML format using MediaTypeFormatter;
Ability to be hosted on IIS as well as outside of IIS;
Model Binding support and validation;
OData protocol support;
Now that’s enough of theory and let’s get down to business creating a Web API that will expose services to update Product information.

READ  About Network APIs (Application Programming Interfaces)

You May Also Like

About the Author: intermzv

Leave a Reply

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