# What’s the Difference Between RPC and REST?

## Metadata
- Author: [[Amazon Web Services, Inc.]]
- Full Title: What’s the Difference Between RPC and REST?
- Category: #articles
- Summary: Remote Procedure Call (RPC) and REST are two different ways to design APIs for software communication. RPC focuses on calling remote functions, while REST is used for creating, reading, updating, and deleting data on a server. REST APIs are generally easier to understand and implement, making them more popular today.
## Highlights
- APIs are mechanisms that enable two software components to communicate with each other using a set of definitions and protocols. ([View Highlight](https://read.readwise.io/read/01k052e4gh6pzeh4r6tepk6stb))
- RPC APIs allow developers to call remote functions in external servers as if they were local to their software. For example, you can add chat functionality to your application by remotely calling messaging functions on another chat application. In contrast, REST APIs allow you to perform specific data operations on a remote server. For example, your application could insert or modify employee data on a remote server by using REST APIs. ([View Highlight](https://read.readwise.io/read/01k052f076bjz9a7eqmak5m1ej))
- Both REST and RPC use HTTP as the underlying protocol. The most popular message formats in RPC and REST are JSON and XML. JSON is favored due to its readability and flexibility. ([View Highlight](https://read.readwise.io/read/01k052g6zsede9a93155r5gxzf))
- In Remote Procedure Call (RPC), the client makes a remote function (also known as method or procedure) call on a server. Typically, one or more data values are passed to the server during the call.
In contrast, the REST client requests the server to perform an action on a specific server resource. Actions are limited to create, read, update, and delete (CRUD) only and are conveyed as HTTP verbs or HTTP methods. ([View Highlight](https://read.readwise.io/read/01k052h27a8f16pe921y760jp7))
- RPC focuses on functions or actions, while REST focuses on resources or objects. ([View Highlight](https://read.readwise.io/read/01k052h4mb6zbkgsgp1hvppsr6))
- n Remote Procedure Call (RPC), the client uses HTTP *POST* to call a specific function by name. Client-side developers must know the function name and parameters in advance for RPC to work.
In REST, clients and servers use HTTP verbs like *GET*, *POST*, *PATCH*, *PUT*, *DELETE*, and *OPTIONS* to perform options. Developers only need to know the server resource URLs and don't have to be concerned with individual function names. ([View Highlight](https://read.readwise.io/read/01k052jzazr4sks2b1dsbveb5x))
- When to use: RPC vs. REST
Remote Procedure Call (RPC) is typically used to call remote functions on a server that require an action result. You can use it when you require complex calculations or want to trigger a remote procedure on the server, with the process hidden from the client.
Here are actions where RPC is a good option:
• Take a picture with a remote device’s camera
• Use a machine learning algorithm on the server to identify fraud
• Transfer money from one account to another on a remote banking system
• Restart a server remotely
A REST API is typically used to perform create, read, update, and delete (CRUD) operations on a data object on a server. This makes REST APIs a good fit for cases when server data and data structures need to be exposed uniformly.
Here are actions where a REST API is a good option:
• Add a product to a database
• Retrieve the contents of a music playlist
• Update a person’s address
• Delete a blog post ([View Highlight](https://read.readwise.io/read/01k052mx32s19fhb6bn8azk9dd))
- In Remote Procedure Call (RPC), the client makes a remote function (also known as method or procedure) call on a server. Typically, one or more data values are passed to the server during the call.
In contrast, the REST client requests the server to perform an action on a specific server resource. Actions are limited to create, read, update, and delete (CRUD) only and are conveyed as HTTP verbs or HTTP methods. ([View Highlight](https://read.readwise.io/read/01jvz6ate3m6vyspjvhny6zgjr))