Code is art...
Code is art...
REST APIs is a “web services” API, they are based on URIs and the HTTP protocol, and use JSON for a data format, which is super browser-compatible.
Example 1:
I used Twitter API in my website, where I can see the newest twits.
Example 2:
I used Google MaP API on m website, that I can see a Google map on my website.
Explain:
API: Application Programming Interface.
Roy Fielding founded REST standard conclude HTTP API.
So Rest API is a standard for describe HTTP API
1. (SOAP)Simple Object Access Protocol
2. (REST) Representational State Transfer
Difference:
SOAP stands for Simple Object Access Protocol and REST stands for Representational State Transfer.
Since SOAP is a protocol, it follows a strict standard to allow communication between the client and the server whereas REST is an architectural style that doesn’t follow any strict standard but follows six constraints defined by Roy Fielding in 2000. Those constraints are – Uniform Interface, Client-Server, Stateless, Cacheable, Layered System, Code on Demand.
SOAP uses only XML for exchanging information in its message format whereas REST is not restricted to XML and its the choice of implementer which Media-Type to use like XML, JSON, Plain-text. Moreover, REST can use SOAP protocol but SOAP cannot use REST.
On behalf of services interfaces to business logic, SOAP uses @WebService whereas REST instead of using interfaces uses URI like @Path.
SOAP is difficult to implement and it requires more bandwidth whereas REST is easy to implement and requires less bandwidth such as smartphones.
Benefits of SOAP over REST as SOAP has ACID complaints transaction. Some of the applications require transaction ability which is accepted by SOAP whereas REST lacks in it.
On the basis of Security, SOAP has SSL( Secure Socket Layer) and WS-security whereas REST has SSL and HTTPS. In the case of Bank Account Password, Card Number, etc. SOAP is preferred over REST. The security issue is all about your application requirement, you have to build security on your own. It’s about what type of protocol you use.