REST APIs and Event Streams Taste Better Together

REST APIs and Event Streams are the strawberries and ice cream of connected applications, says Gustav Rosén, CEO & Founder of Entiros Integrations.

I often get the same question from product owners and developers that are about to build connectivity for their applications: “When do I choose Event Streaming vs. REST APIs for my application? What do consumers want and need?” My response is then: Choose both, they taste lovely together!

These two connectivity techniques are different, yet, I propose they should not be seen as a choice. Instead, Event Streaming and REST APIs are a perfect match due to their complementary flavors when creating a connectivity solution.

The Difference in Technical Flavors

REST APIs are like strawberries — easy to grab and put in your mouth. Great tasting in synchronous, pull-based, request/response interactions. Useful when a consumer wants to perform actions using HTTP verbs (GET, POST, PUT, PATCH, etc.) on information resources of several content types (JSON, XML, etc.). These resources can be combined in higher-level process APIs and channel-specific APIs. In addition to the ease of internal or external exposure, you also get the HTTP benefits of server caching and concurrency. With the addition of GraphQL, you also get the capability to pick exactly the strawberries you want from the box in a query. Neat!

Event streams are like ice cream — a fluffy flow of drizzling information as events on a specific topic — that may require a spoon to grab a portion at a certain offset. Great tasting in asynchronous, push-based, publish/subscribe interactions when a consumer wants to receive events as they come (independent from the publisher and other subscribers). The replayability of the immutable events and the event-driven architecture is built for massive scale, performance, and operability. You can eat event streams in scenarios of notifications, event-carried state transfers, event sourcing (e.g., to feed BI or AI), and CQRS (expanding local CRUD applications into high performing and scalable deployments). Also Neat!


Main Characteristics REST APIs Event Streams
Connectivity Synchronous Asynchronous
Interaction Pull Push
Pattern Request-Reply Publish-Subscribe
Reach Internal or external consumers Mostly for internal use
Operations Caching Replayable

The Perfect Match in Capability

When combined, REST APIs and Event Streams are a great match. REST APIs enable consumers to connect easily with a source application over HTTP, while Event Streams allow consumers to be updated with changes without needing to check the REST API. This excellent combination satisfies many of the use cases we have today while covering emerging use cases of tomorrow without modifying existing applications to accommodate new solutions. Build once, connect anything!

And Oh So Good in Combination

An important point to make here is that when you grab a spoon of this oh-so-delicious dessert, combine the two flavors. That is, make all your REST APIs publish events. When a consumer updates a resource through the REST API, if you make that microservice publish events on what just happened, then other applications can instantly receive a notification event or an event carried state transfer of the resource changed through the REST API.

Vice versa, as your applications publish event notifications, ensure you have REST APIs that can be queried to get the full resource. For batch use cases (e.g., initial loads of complete data sets) use paginated REST APIs or use a REST API to trigger an asynchronous and full event stream publication of the data set.

Content (the Ingredients) Are King of Any Meal

Before you start crafting your strawberries and ice cream and combine them into a dish, I want to highlight another fact: Delicious dishes are made with great tasting ingredients. That is, if you provide an application or information service to a group of users and want to please them fully, focus on the information quality first by ensuring relevance, uniqueness, accuracy, integrity, and timeliness of your information. Key to this is assuring the right sources of information and then exposing your specific information to your consumers. Fresh ice cream is made from fresh cream. Content is always king.

Summarizing the Recommendations

If you are a service provider – build a solution with the combination of REST APIs and Event Streams – once and for all future needs. Don’t forget to assure information quality. Don’t serve sour ice cream. If you are a service consumer — depending on your needs, call APIs when needed or continuously get events published by source apps as they occur.

What Tech Can Implement This Dessert?

So, how do we do it? How do we find the best strawberries (REST APIs), and ice cream (Event Streams) to create truly connected applications? We used to say, “Well, it depends…there are many solutions on the market.” But things have changed. The open-source strawberries and ice cream are now so mature that they are ready to be eaten. For free!

The ability to build REST APIs using microservices in Java or .Net and the ability to fire up Event Streaming platforms using best of breed open source solutions like Apache Kafka is now available to all. Do it yourself or get the same ingredients provided ready to eat from your favorite specialist integration partner of choice.