blog.postman.com Open in urlscan Pro
162.159.129.53  Public Scan

Submitted URL: https://go.postman.com/MDY3LVVNRC05OTEAAAGPs4c9xl8h5Tusn0HvZWhTsvl_dWkG4FvWOZFBfT4fXNyqgfIKgpLiH1x5N3FoJhZzIIHJD7Y=
Effective URL: https://blog.postman.com/grpc-vs-rest/?utm_source=marketo&utm_medium=email&utm_campaign=newsletter&utm_term=nov_2023&utm_...
Submission: On November 28 via api from US — Scanned from DE

Form analysis 2 forms found in the DOM

GET /

<form class="form-inline my-lg-0" method="get" action="/">
  <label htmlfor="search-lc" class="search-label">
    <svg class="nav-search__icon" width="16" height="16" viewBox="0 0 16 16" fill="#6b6b6b" xmlns="http://www.w3.org/2000/svg">
      <path fill-rule="evenodd" clip-rule="evenodd"
        d="M9.87147 9.16437C10.5768 8.30243 11 7.20063 11 6C11 3.23858 8.76142 1 6 1C3.23858 1 1 3.23858 1 6C1 8.76142 3.23858 11 6 11C7.20063 11 8.30243 10.5768 9.16437 9.87147L9.89648 10.6036L9.64648 10.8536L13.5758 14.7829C13.8101 15.0172 14.19 15.0172 14.4243 14.7829L14.7829 14.4243C15.0172 14.19 15.0172 13.8101 14.7829 13.5758L10.8536 9.64648L10.6036 9.89648L9.87147 9.16437ZM6 10C8.20914 10 10 8.20914 10 6C10 3.79086 8.20914 2 6 2C3.79086 2 2 3.79086 2 6C2 8.20914 3.79086 10 6 10Z">
      </path>
    </svg>
  </label>
  <input class="form-control" id="search-lc" type="search" placeholder="Search Postman Blog" aria-label="Search" name="s" autocomplete="off" spellcheck="false" dir="auto" value="">
</form>

POST https://blog.postman.com/wp-comments-post.php?wpe-comment-post=mktgproduction

<form action="https://blog.postman.com/wp-comments-post.php?wpe-comment-post=mktgproduction" method="post" id="commentform" class="comment-form" novalidate="">
  <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p>
  <p class="comment-form-author"><label for="author">Your name</label><br><input class="form-control" id="author" name="author" aria-required="true"></p>
  <p class="comment-form-email"><label for="author">Your email</label><br><input class="form-control" id="email" name="email"></p>
  <p class="comment-form-comment"><label for="author">Write a public comment</label><textarea class="form-control" id="comment" name="comment" aria-required="true"></textarea></p>
</form>

Text Content

 * Product
   
   GETTING STARTED
   
   What is Postman? Customer Stories Download Postman →
   
   API PLATFORM
   
   Collaborate in Workspaces Organize with Collections Explore the API Client
   Build Postman Flows Work smarter with Postbot Browse API Tools
   
   ENTERPRISE SOLUTIONS
   
   Enterprise Essentials API Test Automation Internal API Management
 * What is Postman? API Repository Tools Governance Workspaces Integrations Get
   Started Free →
 * Pricing
 * Enterprise
 * Resources and Support
   
   LEARNING
   
   Learning Center Docs Postman Academy White Papers Breaking Changes Show
   Templates Tutorials Webinars State of the API Report Guide to API-First
   
   COMMUNITY AND EVENTS
   
   Blog Community Postman Supernovas Student Program Events Postman Swag
   
   SUPPORT
   
   Support Center Reseller Support Postman Status Release Notes Contact Us
 * Public API Network

Contact Sales Sign In Sign Up for Free Launch Postman
Blog

 * Learning Center
   
   Learn about how to get started using Postman, and read more in the product
   docs.

 * Labs
   
   Flows, gRPC, WebSockets! Learn about the latest cutting-edge features brewing
   in Postman Labs.

 * Open Technologies
   
   Invest in the knowledge, specifications, standards, tooling, data, people,
   and organizations that define the next 50 years of the API economy.

 * Collection Format
   
   Understand the specification behind Postman Collections. Check out the docs
   and support resources!

 * Blog
   
   The Postman blog is your hub for API resources, news, and community. Learn
   about the Postman API Platform and much more.


 * AI
 * API-First
 * Product Updates
 * Company News
 * Tutorials




GRPC VS. REST

The Postman Team
November 20, 2023· 5 mins

An API is a set of rules and protocols that enable different software components
to interact and exchange data. APIs are essential components of all modern
applications, and our daily lives would be drastically different without them.

There are many different architectural styles for building APIs, and each one
has its own benefits, trade-offs, and ideal use cases. Two of these
architectural styles are REST and gRPC. REST defines a set of guidelines for
building applications that rely on simplicity, statelessness, and resource-based
communication. gRPC, on the other hand, is a high-performance Remote Procedure
Call (RPC) framework that utilizes Protocol Buffers and HTTP/2 to enable
efficient communication in distributed systems.

REST is the most popular style for building APIs today, but gRPC has seen a
surge in adoption due to its support for bidirectional streaming, strong data
typing, and language agnostic code generation. But when should you choose one
over the other? We’ll answer that question—and more—in this article.


WHAT IS REST?

REST, which stands for Representational State Transfer, is the most popular
architectural style for building APIs. In a RESTful architecture, resources are
identified by URIs (Uniform Resource Identifiers), and operations are performed
on those resources using a standard set of HTTP methods. Resources are
represented in JSON or XML, which is transferred between the client and server
in the HTTP request and response bodies.


WHAT IS GRPC?

gRPC is an open source, high-performance framework that facilitates efficient
communication in distributed systems. gRPC is an implementation of the RPC
(Remote Procedure Call) protocol, which enables services to call functions on
other machines as if they were local software methods.

gRPC was developed by Google in 2015, and it includes several features that
enhance the way remote procedure calls are made. For instance, its use of
Protocol Buffers (Protobuf) supports strongly typed service contracts, data
serialization, and code generation in a variety of programming languages. It
also uses HTTP/2 as its transport protocol, which facilitates bi-directional
streaming and reduces latency.


KEY SIMILARITIES: GRPC VS REST

Before we explain the differences between gRPC and REST, let’s first take a look
at some of their similarities:

 * A client/server architecture: Both gRPC and REST follow the client-server
   architecture, in which clients send requests and servers respond by returning
   data or performing actions.
 * Use of HTTP: gRPC and REST both use HTTP as their underlying transport
   protocol. However, REST uses HTTP/1.1, while gRPC uses HTTP/2.
 * Support for many programming languages: gRPC and REST are both language
   agnostic, which means that clients and servers can be implemented in a
   variety of programming languages.
 * Statelessness: Both gRPC and REST are designed to be stateless, which means
   that every request contains all of the information the server needs to
   process it. The server therefore does not have to retain any session state.


KEY DIFFERENCES: GRPC VS REST

Although gRPC and REST have several foundational similarities, they differ
widely in their architectural design, guiding principles, and implementation
details. Their main differences are:


DATA FORMAT

One of the primary differences between gRPC and REST is the data format each one
uses. REST typically uses plain-text data formats, such as JSON and XML. These
formats are easy to work with and debug, but they are less efficient to
transport and parse. gRPC, on the other hand, uses Protobuf to encode data in a
binary format. Data that is encoded in a binary form is more space-efficient and
faster to serialize and deserialize than text-based formats like JSON or XML,
but it is not human-readable.


DATA VALIDATION

REST and gRPC take different approaches to data validation. With gRPC,
developers define a service and message types with Protobuf. This process
involves specifying the format and constraints of the data, such as its required
fields, supported values, and data types. This definition then serves as the API
contract between the client and server, and every message that is transmitted is
automatically validated against this contract. REST services, in contrast, must
perform an extra validation step on JSON data, which increases processing time.


COMMUNICATION PATTERN

gRPC and REST follow different communication patterns. REST relies on a unary
request/response cycle, in which a client sends a single request and then waits
for a single response from the server. gRPC, in contrast, facilitates unary
communication, as well as server streaming (in which a client sends a request
and the server sends multiple responses), client streaming (in which the client
sends multiple requests and the server returns a single response), and
bidirectional streaming (in which both the client and the server can send
multiple messages to one another). gRPC is able to support these streaming
patterns because it uses HTTP/2 as its transport protocol, which supports
multiplexing.


DESIGN PATTERN

gRPC APIs define callable functions on the server, which the client can then
invoke as if it were calling internal functions. This approach is known as
service-oriented design. REST APIs, in contrast, have a resource-oriented
design, in which clients use a standard set of HTTP methods to access resources
through dedicated API endpoints.


CODE GENERATION

gRPC’s use of Protobuf supports code generation in multiple programming
languages. Developers begin by defining the service, its methods, and data
structures in .proto files, which are then processed by Protobuf’s compiler.
This process involves generating client and server code in various programming
languages. For clients, the generated code typically includes method stubs that
correspond to the RPC methods that are defined in the .proto file. These stubs
handle serializing data, making the gRPC call over the network, and
deserializing the response. For servers, the generated code provides a base
class that developers can implement to define the service’s behavior.

Although REST APIs can be developed in a wide range of programming languages,
REST does not provide native support for code generation.


WHEN TO USE GRPC VS. REST

As discussed, gRPC and REST have several distinguishing features that make them
well-suited for different use cases.

REST is the most commonly used API architecture today. It’s easier to work with
and learn than gRPC, has a robust developer ecosystem, and is compatible with
most programming languages and platforms. REST is therefore the ideal choice if
you need to create a public API, as developers at other organizations will be
able to easily integrate it into their own applications.

gRPC, on the other hand, was designed to support highly efficient,
language-agnostic communication in distributed systems. It is therefore better
suited than REST for microservice-based architectures, in which individual
services may be developed in different programming languages and may face
varying workloads. Additionally, gRPC’s use of Protobuf for binary data
serialization makes it the better choice for applications that demand low
latency and high throughput, while its support for different streaming patterns
make it ideal for real-time chat and video applications.

+36
Tags: gRPC REST Tutorials

The Postman Team

 * 
 * 
 * 

Today, more than 25 million developers use the Postman API Platform. Postman
simplifies each step of the API lifecycle and streamlines collaboration so you
can create better APIs—faster. View all posts by The Postman Team.

What do you think about this topic? Tell us in a comment below.




COMMENT CANCEL REPLY

Your email address will not be published. Required fields are marked *

Your name


Your email


Write a public comment





Δ

This site uses Akismet to reduce spam. Learn how your comment data is processed.


YOU MIGHT ALSO LIKE


WHAT IS GRPC?

The Postman Team· 8 mins

gRPC is a schema-driven framework that facilitates service-to-service
communication in distributed environments. It is a language-agnostic
implementation of the RPC (Remote Procedure…

Read more →


HOW TO CHOOSE BETWEEN REST VS. GRAPHQL VS. GRPC VS. SOAP

Bruno Pedro· 4 mins

To create the Postman Open Technologies Knowledge Base API, I’ve been following
our team’s internal API design playbook, which covers the strategy,…

Read more →


INTRODUCING THE POSTMAN VS CODE EXTENSION

Preetham M· 2 mins

Earlier this year, we announced that we would launch the Postman VS Code
extension in 2023. We aim to bring Postman closer…

Read more →


POSTMAN NAMED BEST API PLATFORM

Postman is the #1 place where developers come to work with APIs. See why we’re
top-ranked in G2’s first-ever evaluation of API Platforms.

Read more →

© 2023 Postman, Inc.


PRODUCT

 * What is Postman?
 * API Repository
 * Tools
 * Governance
 * Workspaces
 * Integrations
 * Enterprise
 * Plans and pricing
 * Download the app
 * Support Center


COMPANY

 * About
 * Careers and culture
 * Press and media
 * Contact us
 * Partner program


LEGAL AND SECURITY

 * Terms of Service
 * Trust and Safety
 * Privacy policy
 * Cookie notice
 * Privacy choices


API CATEGORIES

 * App Security
 * Payments
 * Financial Services
 * DevOps
 * Developer Productivity
 * Data Analytics
 * Communication
 * Artifical Intelligence


SOCIAL

 * Twitter
 * LinkedIn
 * GitHub
 * YouTube
 * Asset 2
   Twitch

We use cookies on your device to enhance your navigation experience, analyze
usage to improve our site, and customize our marketing efforts. You can learn
more about cookies in ourCookie Notice.
Reject All Cookies Accept All Cookies
Manage Cookies




PRIVACY PREFERENCE CENTER

When you visit any website, it may store or retrieve information on your
browser, mostly in the form of cookies. This information might be about you,
your preferences or your device and is mostly used to make the site work as you
expect it to. The information does not usually directly identify you, but it can
give you a more personalized web experience. Because we respect your right to
privacy, you can choose not to allow some types of cookies. Click on the
different category headings to find out more and change our default settings.
However, blocking some types of cookies may impact your experience of the site
and the services we are able to offer.
More information
Allow All


MANAGE CONSENT PREFERENCES

STRICTLY NECESSARY COOKIES

Always Active

These cookies are necessary for the website to function and cannot be switched
off in our systems. They are usually only set in response to actions made by you
which amount to a request for services, such as setting your privacy
preferences, logging in or filling in forms. You can set your browser to block
or alert you about these cookies, but some parts of the site will not then work.

Cookies Details‎

FUNCTIONAL COOKIES

Functional Cookies

These cookies enable the website to provide enhanced functionality and
personalisation. They may be set by us or by third party providers whose
services we have added to our pages. If you do not allow these cookies then some
or all of these services may not function properly.

Cookies Details‎

TARGETING COOKIES

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may
be used by those companies to build a profile of your interests and show you
relevant adverts on other sites. If you do not allow these cookies, you will
experience less targeted advertising.

Cookies Details‎

PERFORMANCE COOKIES

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and
improve the performance of our site. They help us to know which pages are the
most and least popular and see how visitors move around the site. All
information these cookies collect is aggregated and therefore anonymous. If you
do not allow these cookies we will not know when you have visited our site, and
will not be able to monitor its performance.

Cookies Details‎
Back Button


COOKIE LIST



Search Icon
Filter Icon

Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label

Confirm My Choices