Blog

Webhooks or APIs? For the World’s Leading Online Marketplaces, the Answer Is “Both”

Sara Matasci - 4 novembre 2021
image

Mirakl is pleased to introduce a new “Tech Innovation Series” focused on the marketplace platform technology innovations that drive the world's most powerful marketplaces. From time to time, we'll highlight the most important attributes marketplace buyers and operators need to know about as well as top considerations facing technical teams. In this post, we're focusing on the difference between webhooks and APIs, as well as use cases for each.

An online marketplace cannot exist without HTTP - the foundation of any exchange that happens over the web. When it comes to the millions of exchanges that occur through a typical enterprise marketplace on a daily basis, the question becomes whether to “push” the information through the use of a webhook or “pull” it using an API.

Loading...

First, a quick refresher on the two communication interfaces and what makes them different. With a webhook, the data is automatically “pushed” to your server in real-time, giving the marketplace operator an instant notification when something changes. Conversely, with an API the server is requesting or “pulling” the data. This “pull” is done at a defined interval (typically every 5 minutes for marketplace operators) and allows the operator to then update the website. Keep in mind, neither a webhook nor API will update your website automatically. For webhooks, an engineer must first create an endpoint to receive and make use of the data on their end - once created, this endpoint can benefit from automation. Conversely, for APIs, an engineer must develop a routine to call the server’s endpoint on a defined basis - they can then automate some actions depending on the result of this call.Online marketplaces can't exist without HTTP, but the question becomes whether to "push" or "pull" the data.

Within an enterprise marketplace, webhooks and APIs serve two separate but complementary functions. One is not better than the other; one is not more modern than the other. As a marketplace operator, it’s important to understand how it is the combination of the two that enables you to operate the most powerful, efficient marketplace possible.

For a better understanding of when to use each communication interface, we spoke with Nelson Dionisi, Senior Engineer Manager at Mirakl.

What are the benefits and limitations of webhooks?

The primary benefit of a webhook is its ability to deliver data in real-time. Rather than scheduling a recurring “pull” call, data is automatically sent to you the moment there is new information. For time-sensitive items, such as customer refunds/debit and seller payments, webhooks can be a valuable tool.

While they can provide instant information, webhooks are considered to be more error-prone. If your server cannot process the information the moment it’s sent, that data will be lost. In addition, marketplace operators need to develop an API “endpoint” – which can be tricky – to collect this information. As previously mentioned, the operator must still process the data before the site can be updated. This process can quickly become overwhelming, especially for large marketplaces, if they are being asked to update all aspects in real-time. For example, some marketplaces have as many as 30,000 product updates every minute.

What are the benefits and limitations of APIs?

Where webhooks might be considered more error-prone, APIs are seen as more error-proof. Because you are requesting or “pulling” the data, you can do it as many times as you need and won’t lose the information if the servers cannot connect. In addition, APIs can be set up as frequently or infrequently as needed depending on the category; this allows operators to set their own schedule and decide how often and when they want to get updates. For example, item deliveries may be pulled less often than customer refunds.

Where APIs fall short, is that they cannot deliver real-time information. Instead, you might get the data a few minutes after you would have with a webhook. In most cases, this is not a problem but is something operators should be aware of.

When should I use a webhook vs an API?

Marketplace operators should consider an assortment of webhooks and APIs to power their marketplaces. Because of their ability to deliver real-time information, webhooks are valuable in cases where the information is time-sensitive and needs to be processed by the operator immediately. This is great for updating inventory quantity, order status changes, or other instances where reacting quickly is key.

If the information is not time-sensitive, it’s best to use an API. This will allow the operator to keep the marketplace up to date, on a schedule they define.

Does Mirakl use webhooks or APIs in its software?

Delivering a world-class marketplace experience requires the use of both types of communication interfaces. This is why Mirakl’s technology uses a combination of APIs and webhooks to deliver a modern and standard way of communication - as is industry best practice. We have painstakingly considered, based on the actual experiences of more than 300 of the world’s leading marketplaces, where each is most appropriate.

At Mirakl we process more than 1 million webhooks a minute, and 130 million APIs on a daily basis. To improve efficiency, we continuously work to streamline and optimize our APIs: allowing for differential updates, bulk updates, and providing the right filters for data requests. This not only reduces the amount of data a system needs to process but also ensures we will never overload a client’s system. Through this combination, our Platform Pioneers can update 30k offers per second, per customer, and 1500 orders per minute per customer.

This ongoing commitment to building a reliable and scalable architecture is one of the many reasons why Forrester named Mirakl a leader in their first Forrester New WaveTM: Marketplace Development Platforms, Q4 2021.

Finding a balance

Because they are more popular with event-driven architectures, webhooks are considered by some as a panacea for all marketplace needs. But the truth of the matter is, a high-performing marketplace should utilize both. When evaluating the foundation for a new enterprise marketplace, be careful not to fall into the webhook hype: instead, work with someone who has a proven track record of incorporating each communication interface, and can create the right solution that will help you scale your business reliably.  If you already have an online marketplace, find out how your software provider is utilizing APIs and webhooks. Having a proper mix of both can help improve efficiency for both your marketplace and your supporting tech team.

Interested in learning more? Contact Mirakl today to begin your marketplace journey, and discover how we’ve helped countless businesses power their enterprise marketplace at scale.

image
Sara Matasci,
Director, Corporate Marketing at Mirakl

Related content