Difference Between REST API and RPC API (original) (raw)

Last Updated : 21 Jun, 2022

REST and RPC are design architectures widely used in web development to build APIs (Application Programming Interface). It is a set of instructions that permits two systems to share resources and services. The client creates a request to the server that responds to it with data in JSON or XML format.

REST APIs

It stands for Representational State Transfer (REST) is an architectural style that defines a set of constraints and protocols to be used for creating web services. REST API is a method of accessing web services in a very simple and flexible manner without having any processing. A REST API endpoint is a URL that utilizes HTTP verbs to execute CRUD (Create Read Update Delete) operations over the resources. These HTTP verbs are GET, POST, PATCH, PUT and DELETE. It focuses on providing resources from the server to the clients.

Advantages of REST APIs

Disadvantages of REST APIs

RPC APIs

Remote Procedure Call (RPC) is a methodology used for constructing distributed, client-server-based applications. It is also called a subroutine call or a function call. It is based on conventional local procedure calling so that the called procedure need not exist in the very same address space as the calling procedure executes. RPC is very well suited for a client-server interaction in which the flow of control lingers between the two. The client and server do not both execute at the same time instead the thread of execution jumps from one to another.

Advantages of RPC APIs

Disadvantages of RPC APIs

Following is a table of differences between REST and RPC

S.No. REST API RPC API
1 REST is resource-oriented. RPC is action-oriented.
2 Supports HTTP methods GET, POST, PUT, PATCH, and DELETE. RPC only supports GET and POST requests.
3 It provides flexibility for hardware architecture no flexibility in RPC for hardware architecture
4 It supports hypermedia and hyperlinks It does not supports hypermedia and hyperlinks
5 REST allows to specify Content-types or accept headers Require payloads of a few data types as XML for XML-RPC.