REST is an architectural model. It’s not a protocol like HTTP. REST is called Representational State Transfer in its full form.
On the other hand, web service is middle layer kind it acts as the middle man between the device to device communication through WWW(world wide web). For example, a Message from an Android Device to the SQL server located at a remote place via WWW.
IOS Device: Mobile device of IOS communicating with SQL Server through RESTful API (Application Program Interface)
Android Device: Mobile device with Android communicating with SQL server.
Web client: It is a client from web connecting to SQL server.
Database Server: In our case SQL server replying back to clients through RESTful APIs.
The Web services which confirm the REST standards are called RESTful APIs. RESTful web services allow requesting systems to access and manipulate the data using a uniform and predefined set of stateless operations.
Stateful Vs Stateless Services
Previous message details store in Stateful and do not store in Stateless service.
- Stateless: Account Balance
- Stateful: Shopping Cart
Here is best book on Micro services interview questions.
Below are the six top features. If you wish to learn in details here is a Video for you.
- Uniform interface
- Links between resources
SOAP Vs. REST
SOAP Simple Object Access Protocol. It’s an old-style of protocol to communicate between different devices. However, it has robust security features, and it supports only XML format. People use this where security is the prime criteria. The best example is the Allstate insurance company. They use Java Web/Mobile clients to interact with Mainframe.
SOAP’s beautiful feature is if a request fails, it tries multiple times (as defined in the API).
REST is an advanced architecture model. You can convert web service as RESTful service by following REST’s rules. It is highly scalable and fault-tolerant.
People use REST APIs in all modern applications since it supports all message formats. Predominately people use JSON/XML.
In REST, the client has to try multiple times- suppose a requested message fails. It doesn’t store information about a request; It is the client’s responsibility.