Push vs. Pull API

Also known as: Webhooks vs. Polling, Pinging,

When an application is tasked with monitoring some data from an external source via an API then there are really only two ways for this application to realize that there is something new.

Push or pull, what's the point of having APIs?

As part of the Digital Employee Experience companies are placing a significant importance on the existence of APIs with business applications they upgrade or replace. This is called being "API-first" and is a corner stone for creating successful Digital Workplace portals.

The old way – Polling

Polling is like periodically hitting the refresh button and seeing if there is anything new between each request.

Imagine you have an app on your phone and you need to 'pull to refresh' it every 10 minutes.

Obviously this is an expensive operation, and Zapier found that ~98% of these requests will be wasted on any API that isn't changing every minute.

The new way – Webhooks

A much more efficient way to monitor for updates is to reverse the roles and have the API send out when it has something new.

That's what webhooks do: A webhook is a URL the application gives to the API and tells it update that specific URL whenever a new event occurs. All the application than has to do, is monitor the URL and it will receive updates in real-time.

Strictly speaking RESTful design principles would demand APIs to be session-less, yet developers prefer to implement webhooks as the code necessary to do so is much, much less.

The upcoming way – TCP/IP WebSockets

Modern browser also support what is called WebSockets which allow servers to push data directly to the browser.

The WebSocket protocol is utilizing a close relative of the HTTP protocol that allows browsers to receive websites from a server. Only now the server and client can actually execute a handshake in order to start an open and permanent channel through which they can exchange WebSocket "envelopes".

This enables the server to push updates towards the clients asynchronously: The client is basically letting the server know what types of information it would like delivered and the server then sends back 'envelopes' in relative real-time.

While this makes applications incredibly fast (Digital Assistant itself uses WebSockets for instance), there aren't too many cross-source applications of this technology yet.