REST API
API: Application program interface
API Example :
If we have to search for something/calculate in google, we send a request through the HTTP to the Google server. The program resides in google server and in that place we can say that the program is API(Application Program Interface). The program (API) finds the searched value or calculate and sends it back to the requester through HTTP again.
Local program -----------HTTP-------google server (Program) API
History :
1999 -- SOAP -- W3C
2000 --- REST -- Modern way of doing APIs
W3C -- SOAP
SOAP -- XML -- RPC
This is the SOAP way of API call. Is REST different from This?
For both, it's the same in architecture, but the difference is in Method. For SOAP, the method is always POST because it's never used whereas for REST the method contains the remote server address.
Main methods used in HTTP start lines are ,
1.Get -- (REad)
2.Post -- (Create)
3.Put -- (Update)
4.Delete -- (Delete)
Mostly CRUD operation.
Rest is essentially calling the records.
REST :
Using a simple example,
If we are searching "technocart" on the google page.
In the above image, we search for technocart, and the google server has a Program (API) that returns us the URL/webpage for technocart.
Here We send a request for a webpage which means to get a web page. So here the most suitable method is "GET" (among Get, post, put and delete). This is REST. If we would use SOAP, it's always "POST".
So here it's not run any program, rather just go and get the web page for technocart.
Cache :
SO in the above example, once we get the web page we can store it in the cache. Next time when we reach google for the same webpage, By "GET", it will not send a new web page, it will say it's already in your cache.
Stateless :
Rest is stateless. The state is a point in time. But how it's related to REST?
As per the above example, if we search for technocart, it went to google server but the google server is not running. It's shut down. It will wait for the server to start, then it will send the response/get the web page, unlike SOAP.
In SOAP, a program is run and a breakdown happens which can be a measure issue. So REST doesn't depend on the state of the server.
#RESR API#restAPI
#RESTApi
#restapi
#rest
#REST
#integration
#webservicesAndAPI
#webservices
#api
#soapapi
#soap
#SOAPAPI
#restvssoap
#soapvsrest
Comments
Post a Comment