What is ASP.NET Web API ? Firsty We have to Understand What is API ? API Stands for "Application Programming Interface" is a set of software or piece of code which perform some specific task and provides response in Universal format like (JSOn/XML/Other Formates) and It uses Client Server Constraints , In which Client sends request to the Server for specific data defined into the Header and Server Process on the request and sends Response back to the Client. So Client perform his/her specific task without interering from the server side and vise versa is also true.
Here Client may a Browser or it may be Console Application or it may be a web application User Interface or It may a Mobile Device or it may be IoT type things also.
ASP.NET Web API :- ASP.NET Web API is a Http based service built on the top of the .NET Framework and these services deployed anywhere on Internet and accessed by the clients like Browsers,Mobile Applications,Desktop Applications and IoT devices. It is Independent Software Architecture that use Http protocol for sending and receiving data. It has a Client Server architecture in which Client sends request and server process on that request and sends response back to the server in the Universal format like Json/XML/other formates.
ASP.Net Web API Sketch Diagram is shown below.
Explanation of above diagram :- In the above diagram we have write WebAPI for showing details for voters based on the Areacode and we deployed this Web API on https://emsanalysis.com on the Internet. In the above figure there are four clients which are accessing these Web API by sending request https://emsanalysis.com/VoterDetails?AreaCode=12356 to server. Server process on the request and response back to clients like Desktop Application,Mobile Devices,Iot,and Browsers. Response contains JSON data or XML data or any other formates which specify into the header and according to response data client parse the data and display it. The most common use of Web API is to build Restful Services.</strong> So now question is what is Restful Services ? REST stands for Representational State Transfer is an architectural pattern that is mainly used for creating API that is based on HTTP protocol.
REST includes some rules that is used for creation of API, which includes
Client Server Pattern
StateLess Requests
Cacheability for Data
HTTP Verbs for Communication
HTTP verbs are the predefined set of rules which is used for accessing these resources so there are mainly used VERBS are
GET
PUT
POST
DELETE
POST is used for sending some data to server so we can add data into the body of message. so POST is generally send data for save or process data on server according to it.
PUT is used for sending some data to server for update data based on the conditions or data appended into the body of message. In simple we can say that it is UPDATE operation for WEB API.
DELETE is used for delete some data from the database server based on the key values appended into the URL or we can say that it is DELETE operation for WEB API.
No comments:
Post a Comment