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

Submitted URL: https://go.postman.com/MDY3LVVNRC05OTEAAAGPs3GkOpwQ7HLTV8PUtS_kyKw9lcdyJcWkPtl0JYLsEbUI69dQtgfckflEeASkyHUoOJyVfHU=
Effective URL: https://blog.postman.com/examining-use-cases-for-asynchronous-apis-webhooks-and-websockets/?utm_source=marketo&utm_medium...
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




EXAMINING USE CASES FOR ASYNCHRONOUS APIS: WEBHOOKS AND WEBSOCKETS

Ian Douglas
October 25, 2023· 5 mins

In an age where digital immediacy and real-time feedback dominate user
expectations, asynchronous APIs stand out as a beacon for enhanced interactivity
and efficiency. These APIs embrace the webhooks and WebSockets model, enabling
event-driven architectures that power many of today’s leading tech platforms.
Let’s explore the top five technical merits of asynchronous APIs with examples
of companies that have effectively integrated them.


WHAT ARE WEBHOOKS AND WEBSOCKETS?

Let’s start by examining the difference between webhooks and WebSockets.

Webhooks are stateless, meaning that each event notification is independent and
carries all the necessary information about the event. Webhooks act a lot like
RESTful API calls because HTTP is a stateless protocol and each connection needs
to provide its own context for the action needed on a given resource. Webhooks
are generally called on an as-needed basis when an event occurs, as opposed to a
long-lasting connection like WebSockets.

WebSockets, on the other hand, are stateful, meaning that the client and server
maintain a persistent connection and can share state information throughout the
lifetime of the connection. This long-lasting connection allows the client and
server to remember the “state” of the conversation. However, if a WebSocket
connection is interrupted and reestablished, the client and server need enough
context in that connection to resume their conversation.


REAL-TIME INTERACTIVITY AND ENGAGEMENT

One of the foremost advantages of asynchronous APIs, especially WebSockets, is
the ability to offer real-time interactivity. Unlike traditional
request-response models, WebSockets establish a two-way communication channel,
enabling servers to push data to the client instantaneously. Slack, the
collaboration platform, utilizes WebSockets to instantly deliver messages and
notifications, ensuring a seamless conversational experience. The end result is
a highly engaged user base, with data being exchanged in real time.

Slack also allows users to use third-party webhooks to carry their event-driven
architecture to another level. Users can generate content within Slack based on
external events, or vice versa, to trigger external webhooks when a message is
created within Slack.


EFFICIENT USE OF RESOURCES

Webhooks, an integral component of asynchronous APIs, play a pivotal role in
optimizing resource usage. Instead of periodically (and constantly) polling
servers for data or checking if a task is complete, systems can rely on webhooks
to notify them when specific events occur. GitHub, the popular software
development platform, leverages webhooks for various operations, such as
alerting Continuous Integration (CI) tools when a new commit is made. This
eliminates unnecessary network requests, reducing server load and ensuring
optimal performance.

That said, WebSockets still send a “keep alive” packet about every 30 seconds to
maintain the connection between the client and server, but this approach is
still far more efficient than the polling methods of typical RESTful APIs.


ENHANCED SCALABILITY

An inherent benefit of event-driven architectures powered by asynchronous APIs
is their ability to scale effortlessly. Stripe, the payments infrastructure
giant, employs webhooks to notify users about different events, like charge
completions or invoice updates. By decoupling the event generation from its
consumption, Stripe ensures its systems remain resilient and able to scale based
on demand without degrading performance.

Scalability is an interesting aspect of API performance. An early limitation of
WebSockets was the number of simultaneous clients that a server could handle,
but some clever networking tricks with load balancers and virtual networks now
allow for millions of connections.


IMPROVED USER EXPERIENCE

With the rise of web applications that demand instantaneous feedback,
asynchronous APIs deliver an unmatched user experience. Trello, the visual
collaboration tool, uses WebSockets to update boards and cards in real time.
When a team member makes a change, every other member views the update
instantly, which supports collaboration and helps keep everyone on the same
page.

Many organizations can keep clients up to date in this fashion using a
“publish/subscribe pattern,” also commonly referred to as “pubsub”. When an
event happens, like a team member updating a card in Trello, that event is
“published” to a channel that other teammates subscribe to when loading the UI.
The WebSocket connection “subscribes” to these event channels and the teammate’s
client can act on that new event.


FLEXIBILITY IN INTEGRATIONS

An often-underestimated merit of asynchronous APIs is the flexibility they offer
in third-party integrations. Platforms like Zapier, an automation tool, thrive
on webhooks to connect disparate systems. Users can set triggers in one
application to initiate actions in another, weaving a web of interconnected
tools that work synchronously. This flexibility expedites workflows and
automates manual tasks, driving efficiency.

Similar to the “pubsub” model described above, tools like Zapier can also
publish these events to a similar channel, allowing for multiple parallel events
to be triggered simultaneously.


CAVEATS: WHEN ASYNCHRONOUS MAY NOT BE IDEAL

Asynchronous APIs have a lot of advantages over RESTful APIs, although the
RESTful architecture can mimic many of the features mentioned above. However,
despite these new features, it’s important to recognize where asynchronous
architectures might not be the best fit.

 * Data consistency: Data consistency is paramount in many
   applications—especially financial systems like banking platforms.
   Asynchronous systems can sometimes lead to temporary data inconsistencies,
   which can be detrimental in such contexts. It’s therefore important to use
   highly-detailed timestamping in order to know which information is to be
   processed in the correct order.
 * Complex error handling: Handling errors in asynchronous setups can be more
   complex than synchronous counterparts. The “unknown” nature of when events
   are generated and when they are handled means that errors might need
   sophisticated recovery mechanisms to replay what happened. Reproducing bugs
   becomes more complicated as a result.
 * Overhead of infrastructure: Asynchronous architectures, especially when
   driven by webhooks, may require a robust infrastructure to manage event
   subscriptions and deliveries. For small applications or startups, this
   overhead might be overkill and unnecessary.


WRAPPING UP

The choice to implement asynchronous APIs, be it through webhooks or WebSockets,
stems from the desire to craft scalable, efficient, and interactive
applications. Platforms like Slack, PayPal, and Stripe exemplify the strength of
this architecture. However, the suitability of this approach hinges on the
specific requirements and constraints of the application. Like all architectural
decisions, a careful analysis of the needs and trade-offs is essential. But when
aligned with the right use case, asynchronous APIs emerge as a modern marvel of
digital engineering.

We have some great documentation to help you get started with WebSockets. If
you’re looking to build a callback architecture for your event-driven work, we
have you covered with webhooks, as well.

Technical review by Pooja Mistry and Melinda Gutermuth.

+6
Tags: Integrations Tutorials Webhooks WebSockets

Ian Douglas

 * 
 * 
 * 

Ian Douglas is a senior developer advocate at Postman. View all posts by Ian
Douglas.

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


POWERING HOME AUTOMATION WITH WEBSOCKET APIS

Joyce· 4 mins

In Part 1 of this series, we learned about the WebSocket protocol and how to set
up our own WebSocket server in…

Read more →


HOW TO RUN A MONITOR WITH THE POSTMAN API

David Espi Hernandez· 6 mins

Postman Monitors provide continuous visibility into the health and performance
of your APIs. Collection-based monitors let you run API test scripts, chain…

Read more →


HOME AUTOMATION WITH MQTT

Joyce· 3 mins

Home Assistant is a popular open source home automation platform that provides a
unified interface to control and monitor different smart devices….

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