What is API in a Nutshell?

What is API in a Nutshell?

The term API may not be new to you especially if you're into web development or programming.

However, for a non-techie, it may sound gibberish and complex. If that is you, worry not! It sounded the same to me as a newbie in tech.

API is an interesting and important concept to understand due to the huge role it plays in software development. A lot of large organizations build APIs for either customer use or their internal use. In this article, I will try to explain API in an easy-to-understand way. Let's delve right in!

Contents

  1. What is an API

  2. How Do APIs Work?

  3. Why do we need APIs?

  4. Types of API

What is an API?

API stands for Application Programming Interface. Let us break this down by looking at each term:

Application - is a software program that follows a set of instructions to carry out a particular task.

Programming - which means it's a programmed piece (i.e a sequence of instructions) written with a programming language.

Interface - an intermediary (or a middle man) between two systems.

It is interesting to note that APIs are much more than their name implies but one keyword that will help us grab the concept better is the interface.

API is a software program that presents an interface for other software programs (or applications) to interact with, and access data and functionality easily and securely.

In other words, API is a software application that works behind the scenes and allows communication between two applications.

API as a Waiter/Waitress

Let's try to break down the concept using a simple non-IT-related example. This analogy would be a waiter/waitress in a restaurant.

When you visit a restaurant, a list of dishes is available on the menu. To have any of them, you do not walk up straight to the kitchen to order your food. Rather, you send your request to the waiter/waitress who will then place your order in the kitchen and return with the food you ordered for. Easy peasy!

At this point, you didn't have to worry about the ovens, stoves, recipes, and all the behind-the-scene activities that took place during the meal preparation.

Waiter-please1.webp Image adapted from: mvam.org/2018/08/27/waiter-please

In this metaphorical example, you represent the user(or one application on one end - say application A), the waiter/waitress represents the API(the intermediary software) while the kitchen represents the backend server(application B).

An API abstracts the complexity of the behind-the-scene logic of a software system while presenting an interface to interact with.

How Do APIs Work?

Applications, whether web, mobile, or desktop are created in a way that humans can interact with them. However, for an application to communicate with another application, it is through APIs.

APIs work using a set of rules that defines how computers, applications, or machines can talk to each other.

ONE APP.png

API is a safe and secure way to transmit data because it respects privacy. It takes only a piece of data from its initial user and returns with the required data exposing only the code that is needed to complete the data processing.

A real-life example of API implementation that is common is a social login. You may have encountered a situation where you try to access a website or an application and it presents you with different social login options. Sounds familiar? This is API working in the background.

images (1).png Image showing social login options

Here's what happens in the background. The API fetches your already existing data from a social network such as Facebook, Twitter, or Google, which is then used to sign you in instead of creating new login details specific to that website or application.

Other real-life examples of APIs include:

  • Weather API.
  • Payment gateway API such as Pay Pal.
  • Google Maps API, et cetera.

APIs have something called endpoints. Depending on what functionality or data you want to access, it is the endpoint you communicate with using a stipulated protocol that will state the input you require in other for you to get your desired result.

In the world of software development, API gives you access to data from a third party. It allows different apps and services to exchange information. Companies can open up their applications’ data and functionality to other third-party developers, internal departments within the organization, and business partners through an API.

Why do we need APIs?

Imagine if you had to write code from scratch for every problem you needed to solve. Imagine how time-consuming that would be? Yeah.

What if you could just have access to data already provided for by people specialized in working in that domain? This is the summary of why we need an API!

API gives you access to the resolved data as quickly as possible without you having to reinvent the wheel by coding from scratch. So, every time you want to integrate that particular solution into your program, all you have to do is to initiate an API call to fetch the ready-made solution.

Whether you're developing a new tool or managing an existing one, API simplifies the process for you. Here are some benefits of APIs:

  • Boost Collaboration

APIs makes it possible to seamlessly integrate multiple apps and platform to communicate with one another. This brings about collaboration.

  • Innovation with Ease

With APIs, you get this flexibility of partnering with businesses, building new services for different organizations to integrate, improving what's presently available in the existing market, and making huge returns out of it. At the end of the day, you're driving digital transformation.

  • App Security

Since API is the intermediary between your data and your server, it provides an added layer of security for your application. Here's how. Before an API can be accessed, certain details are requested such as tokens, signatures, API key, and the rest. All of these contribute to strengthening the security of the API.

Types of API

  • Open APIs

They are open-source APIs made available to the public for access without no restriction. You can have access to its data and services as an external user.

  • Internal APIs

In contrast to the Open APIs, internal APIs are referred to as private APIs. You can only have access to it if you are an internal member of the organization. They are designed specifically for internal users.

  • Composite APIs

It is a combination API that adds up to different data and services. The advantage of using composite APIs is that they speed up the execution process and enhance performance.

  • Partner APIs

Like private APIs, they are not available to the public. However, if you want to have access to it, you need some sort of license or specific rights.

In conclusion, APIs have made the development of applications with a variety of features a lot easier and of course, its benefits in the software development world cannot be overemphasized.

I hope this article explains APIs in a basic manner. Feel free to add your take about APIs in the comment section.