API for everybody

Derick Chen
6 min readOct 22, 2020

Why do you need to know about API?

With the increasing efforts of digitalisation of our business world, computer programmes and softwares become the de facto solutions for problems both old and new. But here comes the problem: you are using softwares that your company has developed a decade ago whose interface resembles that of Apollo Mission moon-shot computers, and slick and modern softwares designed and coded in a set of entirely different programming languages. The worst part is that they don’t talk to each other.

There is an increasingly dividing decentralisation of business softwares. You could be using a database your company have in your server room, or you might be using a cloud solution from Google or Amazon. But the important question is how to have access to that critical data to fulfill your business missions regardless where the data are physically stored? What if your corporate website that is based in your company server and needs to access the data from the cloud? How do you do that?

Another scenario is that your company could have adopted various software solutions for different part of your business workflow, and they have worked great independently to improve your teams productivity. However, you realise that there are manual point-and-click operations still required to bridge that flow of digitalised business processes from one platform to another. For example, you could be using a brand new Content Management System for your corporate website, but you still need a human hero to tirelessly copy materials from your Google Sheet planner or old documents in PDFs. We are in the 21st century and you wonder why do we still need to waste precious man-hours doing simple tasks like that?

This is where APIs come into the picture.

API stands for Application Programming Interface. Techie jargons away, it really means a set of rules for different electronic devices to talk to each other. So you can construct a pipeline to process business data from the minute they are entered into the system, to the end product state with minimal human manual inputs.

This article will help you understand the big picture of how APIs work without technical jargons and crazy acronyms, but with real life analogies that everyone has some experiences of. This discussion is for everyone from sales executives, HR-representatives, project managers and others with no programming background and sees the importance of API going forward or is required to have a basic understanding in your current, or next job, in the ever expanding world of Web-based APIs.

How does API work / what does it do?

APIs are ultimately tools for communication. The concepts and philosophies behind APIs evolved from simple and familiar devices that we see in our daily lives. Let’s hear a quick story about walkie talkies and the relevance will become clear in the next segment.

John and Dave love walkie talkies.

They are neighbours and they each have one. John told Dave that if they want to talk, they will both be on Channel 3.

At 8pm, knowing that Dave is back at home after work, John transmitted, “Hey, do you copy?”

No response from Dave after a minute but John definitely heard Dave’s squeaky floorboards upstairs. Popping his head out of the window, John yelled upwards, “Is your walkie dead? I am trying to reach ya!”

“No I am right here and I heard you.”

“Then why didn’t you respond?” asked John.

“How do I know that you were talking to me? And I can hardly tell that it’s your voice over the static noise” complained Dave.

John let out a sigh and tried again. “John to Dave, do you copy?”

Again, there is no response.

“Hey what’s going on? Are you gonna answer or not?!” yelled John.

“You are supposed to say ‘OVER’ at the end, idiot!”

Just like John and Dave’s struggle over their walkies, natural languages that we speak everyday are composed by a myriad of rules and established norms. We are just so familiar with them that we don’t even think about it.

API is designed the same way so different parties can understand the message.

As you know, there are numerous programming languages serving different operating systems, different system layers and different purposes. So API acts as a protocol, or a bridge, to establish a common ground for these complex and vastly different devices in different locations to talk to each other with ease. Just like it doesn’t matter which floors John and Dave live on or where their apartments’ windows face and they can still talk over the walkie talkies.

With the intrinsic inflexibility in programmes as compared to human to human communication, both machines involved in the communication must follow a strict set of rules. Just like how Dave wouldn’t respond to John over the walkie talkie till he started saying “over” at the end of every sentence so Dave would know that it is his turn to speak.

Despite the seemingly restrictive format and layout constraints imposed by an API, it is very effective for machine to machine communication. This is because you know that there will definitely be a reply if you phrase your queries right, and you know exactly how the reply will be formatted every single time so you can prepare what you will do with the data! Consistency is key.

Now you know what to say to another device, then the next question is how?

One of the most popular style of API is the client-server model. A client is a device that initiates a request, and a server is one that supplies with the information.

This is like going to the information counter in a mall and ask where is the Nike store. In this case, you would be the client, with a request to find out the location of the Nike store. And the staff at the information counter would be the server, to supply you with the information you requested.

But first, you must find the information counter at the mall, right? So you go to the mall directory or map to find out where is the information counter. In the world of API development, this is called the documentation — basically an Encyclopedia to tell software developers where they can send information requests to, and how they should format their messages.

Web APIs can be found at fixed URL links, just like how the information counters usually stay in the same spot of the mall through the years. The query messages from the client must also be a common format, because the server is expecting to communicate in a certain way. Some of these formats include XML and JSON. This is like implicitly agreeing to speak English so both you and the information counter staff would understand and contribute to the conversation.

But this only staff at the counter might be new, and he/she might not even know where the Nike store is! So you are told that he/she can’t help you. Or perhaps this staff is doing other things and you get impatient and keeps repeating the same question over and over again, till he/she responds!

API servers would need to deal with scenarios like these. The client could be asking for questions that the server doesn’t know the answer, or is sending requests too frequently that the server could be overloaded. The server would reply with a commonly agreed upon, numeric status code and potentially an error message to announce any issues it faced with completing the query. If all goes well, the server would send a success code and deliver all the information that you require, so you can go on a shopping spree at Nike.

And perhaps in the best mall in the world, the minute the info counter knows that you are heading to Nike, they send a message to Nike store to have a sales representative waiting for you by the door for the best shopping experience. With APIs, integrations between softwares serving different steps of the customer journeys are possible. You could tremendously improve the experience of your customers and the lives of your staff at the same time!

Digital transformation is an irreversible trend of the next decade. After gradually adopting a myriad of licensed softwares, the next step for you and your organisation would be to improve the scalability and flexibility of your digital workflow, yes you guess it, with APIs! Most big name enterprise softwares like Google Drive have their own APIs that your developers could connect to. These softwares also provide extensive documentations, or user manuals, to provide instructions on how to connect to their API and make the best out of it.

I hope this article has given you a brief understanding of the business side of the API story. I am a firm believer that technologies should not only be understood by software developers. But in case you are a budding developer yourself, I am working on the next article to introduce API implementation strategies with the popular language Python and its Flask framework. Stay tune.

--

--

Derick Chen
0 Followers

Full-Stack Developer at DBS Bank