🧩 What the heck is an API?
By: Mohit Mamoria
Tags: Knowyknowy, API, Technology, Education, Bitcoin

Why does the world need APIs?

Now that we know that the APIs are the way how computer programs talk to services (other computer programs), the question arises, why do we need them at all.

For us to realize the value of APIs, let’s consider an example.

A world without APIs

One sunny morning, you announce it to the world that you’re starting a business of helping people search and book flight tickets. You get yourself an office, a table, a chair, and a laptop. You’ve got the website of all the airline carriers opened in different tabs of your web browser. You’re ready for business!

A few minutes later, your best friend calls you and asks, “Hello friend, can you help me book the best flight from New York to Los Angeles?”

You say, “Certainly, my friend. When do you want to go?”

“February 14, please,” your friend replies.

“Morning or evening?”

“I plan to surprise my long-distance boyfriend, so, morning please.”

“Okay, can you hold on for a minute, please? I’ll search for the best flights for you.” You put the call on hold and start frantically searching for the best flight. You have zeroed down on a few options. You start telling your friend, “Okay, I have got a few options for you…”

While you’re narrating the options, your friend interrupts you and says, “Well, I think, it’d be best if I travel a day before on February 13 instead. Can you please search for the best flights for a day before, please?”

Being the kind businessman that you’re are, you hide your disappointment behind your enthusiastic voice, and respond, “Not a problem at all, my friend. Give me a moment please.”

After an hour of to-and-fro, finally, you’re able to find the best flight for your best friend. You ask your friend to send $139 to your account right away, so that, you can book a flight on their behalf.

Your friend fiddles with their phone and after spending some time, they make an online transaction of $139 to your account. Once you receive the amount, you start to book the said flight, and that’s when you realize that the fare has increased by $35.

Slightly embarrassed, you pass the news to your friend, and they take a few more minutes to send you an additional $35.

After a long phone call, searching frantically across various airline carriers, making multiple bank transactions, your best friend can finally surprise their boyfriend.

As soon as you hang up the call, your neighbor calls and tells you, “I want to travel to Iceland this summer with my family. Can you help me book a flight, please?”

You sulk realizing this phone call would be the same adventure all over again. Regardless, you proceed to help your neighbor.

A few more calls later, the day ends, and with it, you decide to shut the shop. It isn’t worth it!

That’s the problem when human beings work as ‘glue’ trying to make multiple pieces move together — taking instructions from customers, searching for the same thing across many airline carriers, comparing the options manually in the head, verifying the received payment, book the flight, etc.

Human beings aren’t efficient in being the glue. Computers are.

☝ Tweet this?

An API powered world.

Now, let’s look at the world that is powered by APIs.

You announce it to the world that you’re in the flight booking business, and anyone can search and book the best flights “on your website”.

Your website takes the input from your customers, then talks to all the airline carriers via their API, gather all the results, compare and find the best flight, and shows to your customers, within seconds.

Once the customer selects the flight, your website talks to their bank via APIs and accepts the payment.

As soon as the payment is confirmed, your website books the flight on behalf of the customer with the selected airline carrier via APIs.

Your website does it all by itself, while you sit in your corner office and count the cash.

The ability of computer programs talking to each other, via APIs, makes it possible to automate almost everything one can think of.