Composite API

Composite API thumbnail

What is a Composite API?


A Composite API executes a series of REST API requests in a single call. The output of the initial request can be used with the input to a subsequent request.


A Composite API is like a waiter taking multiple orders at once.

Imagine you are in a restaurant and a waiter comes to take your order. You are sitting all the way at the end of the restaurant in a single row of tables. Instead of taking your order, then going straight back to the kitchen to deliver the order to the Chef, it is more efficient for the waiter to take the order of each table on their way over to the Chef.

Starting with you, the waiter will stop at each table and take each order on their way back to the kitchen. Once the waiter has reached the kitchen, they will give the Chef all of the orders.

In other words...

A Composite API lets you perform multiple actions that are then communicated in a single act.

Why is a composite API important?

It's one thing to know what a term means, but that is worthless if you don't know why you should know what a composite API is in the first place. Let's break down the importance of this tech term based on two high level categories. We'll walk through an explanation as well as provide a score, 1-10, that shows you how much you should care about composite APIs.

Pre-Product: 2/10

The first will be if you do not have a product yet. This means that you don't have a physical product. Maybe you're in the ideation phase, or maybe you're almost ready to start development. Whichever it is, we'll get into why a composite API is important and why you should or shouldn't care about it if you do not have a product.

As a founder, a Composite API is not too relevant if you don't have a product yet. You should learn about the functionality of an API, but the actual type of APIs is more relevant once you actually have a product and need to understand how your site should function most effectively.

Live Product: 6/10

The second category is if you do have a live product. Maybe you just launched your business or maybe it's been live for years and you're continuing to improve its quality. Regardless of the scenario, if your product is live, a composite API carries a different weight.

As a founder, a Composite API is not too relevant unless you want to have a deeper understanding of how your developers are most efficiently working with your APIs. You should at minimum, have an understanding, of the type of APIs that are being used, but the actual technical details of how it works is more on the shoulders of your developers.

Examples of Composite APIs

So you know what a composite API is, by definition. You know if you should care about it or not depending on your situation as a business/company/product. To dig in deeper, we will walk through some examples so we can make sure you really have a solid grasp on composite APIs.

Three real-life examples of composite APIs:

First thing to note is that a composite API is different than a batch API in that a composite API executes a sequence of API calls whereas a batch API executes a lump of API calls at once. Let's walk through some examples of composite APIs.

  1. Purchasing an item on Amazon

    When you go into Amazon to purchase an item, you first have to find the item, then add it to your cart, then go to checkout and finally make the payment. Rather than executing all of these actions one by one, Amazon will execute these actions in a composite API when you make the purchase. When the purchase is made, the customer order will be created, the items will then be added to the order, the listed quantity of the item will be decreased by your quantity of purchases, your order status will be changed to purchased and your money will be withdrawn. All of these steps will be followed in a sequential pattern in one go, rather than one at a time.
  2. Paying an invoice via Quickbooks

    When you pay an invoice, there are multiple steps involved to ensure that the invoice is taken care of. Signing into your account and clicking pay makes it easy for you as the user, however behind the scenes there is an order of steps that occur, all within the same "Pay" action. Quickbooks first has to withdraw money from your account, it has to mark on the system on your side that the item has been paid, it has to mark in the system on the businesses' side that the invoice is on its way and credit their bank account accordingly.
  3. Making an restaurant reservation using OpenTable

    In order to make a reservation on OpenTable, you have to determine where you want to eat, what time, and how many people you'll be eating with. Once you make that reservation, the system will execute a series of actions, such as informing the restaurant of the reservation, reducing their availability from future selections, and confirming your reservation.

Key Takeaways:

  1. A Composite API lets you perform multiple actions that are then communicated in a single act.
  2. If you don't have a product, you don't need to worry about this.
  3. If you do have a product, think about how you can utilize composite APIs to make your user's experience more seamless.
Not seeing a term? 🤔