What makes Rest different from RPC in spring boot?

Viewed 177

We usually follow the MVC pattern while creating Rest API. I Often Confuse this sometimes with RPC since people tell me it should be in Http format and Making a CRUD operation from Spring boot does not make it Rest API. So, I want to know whether RPC is similar to Rest API or not?

1 Answers

REST

Representational state transfer (REST) is a software architectural style that was created to guide the design and development of the architecture for the World Wide Web. REST defines a set of constraints for how the architecture of an Internet-scale distributed hypermedia system, such as the Web, should behave.

REST is defined by resources that encapsulate entities.

Source: https://en.wikipedia.org/wiki/Representational_state_transfer

RPC

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction.

Source: https://en.wikipedia.org/wiki/Remote_procedure_call

Difference

With REST every resource has an address (URL) and a representation (for example JSON) and the resources are accessed using HTTP verbs (GET, POST, PUT etc).

In RPC you want to call a procedure/method. A typical protocol will be SOAP where you always use POST requests with a XML protocol with a header and body.

Related