What Is An API?

What Is An API?

A BEGINNERS APPROACH

Introduction

Although the term API is commonly used in the tech industry, it is a long-phrase for what it does and not many people understand how it works. This post is for you if you've done your research or made use of it but only have a basic understanding of it. If you're like me and have no idea what I'm talking about, welcome home.

An API is a set of programming codes that allows you to query data, parse responses, and transfer commands between different software platforms. They're widely employed in a variety of sectors and contexts to provide data services.

Did you get anything out of it? No, me too, lol. In this article, we'll be tackling this topic in simplicity, so sit back and enjoy.

Brief History of the API

API history.jpg

The past is behind, learn from it. -Thomas S. Monson.

The API was conceived in the 1940s by two British computer scientists working on a software library for an early computer. The library's subroutines ( a sequence of program instructions that performs a specific task) were stored on punched paper tape ( A form of data storage that consists of a long strip of paper in which holes are punched), which was kept in a filing cabinet.

A "library catalog" was also kept in this cabinet. It was called a library catalog because it instructs a programmer on how to use or ("call") each subroutine that the programmer need, this catalog is known today as an API documentation.

In the 1970s and 1980s, computer networks grew more common. The API was made more widely available. As programmers desired to access libraries not only on their computers but also on computers in other locations. RPCs (remote procedure calls) and web APIs were born as a result of this.

Fast forward to now, and the API has evolved into the modern web's communication backbone.

Meaning of an API

An API can be likened to a phone, it receives information from you and sends it to the other person, when the person receives the information and responds accordingly it sends the response back to you -The Revealer

API Meaning.jpg

An API (Application Programming Interface) is a piece of a program that allows two or more applications to communicate with each other. In the same manner, you communicate with your friend through your words same way apps communicate through the API.

It allows your application to interact with an external service using a simple set of commands. It is a powerful and versatile means to connect diverse software applications, as it allows a wide range of software products to interact with one another.

The API has a unique characteristic in that it hides the technical details of how the app works, only exposing the parts that are relevant only to the programmer. When you use your uber app to get food, for example, you simply select the meal you want and press the order button. APIs interface with one another behind the scenes of the app to ensure you don't starve to death, lol.

How an API works

An API is made up of different parts, to understand how it works we would need to understand each part individually.

API CALLS

This is the process of the client API(The application that wants to access the resource) submitting a request to the server API (The application providing the resource). When a request is submitted to the server, the API sends the resource to the client if the server has it but, if it does not it returns an error message.

REQUEST METHODS

Sometimes clients want the server to perform specific functions, they are called request methods. The four most basic types of them are;

GET: To get a resource
POST: To create a new resource
PUT: To edit or update an existing resource
DELETE: To delete a resource

API KEY

Have you ever imagined how companies like Google manage their API services to millions of people, that's where an API key comes in. An API key is like a user name and password that uniquely identifies you. Companies use it to manage and control the people making use of their API. When you make use of youtube's API for example, youtube would be able to control the number of requests you make per time and even track how you make use of it.

API DOCUMENTATION

API documentation which is sometimes called an API specification shows the programmer what the calls and requests mean and how to use them. It is similar to a manual for a gadget.

Popular Examples of an API

SOCIAL MEDIA BOTS

A bot, short for robot, is a software application that conducts automated operations. It is sometimes referred to as a web or internet robot. - Wikipedia

twitter-bots.jpg

If you spend any time on Twitter, you're probably aware of the #100DaysofCode bot, which is in charge of retweeting any tweet made using the hashtag #100DaysofCode. These bots work in such a manner that whenever a specific event occurs, the Twitter API sends a signal to the bot, instructing it to reply to the event. The events act as triggers, causing the bot to respond as designed. According to how it is programmed to respond, it can like, retweet, and even comment 'Keep going.'

THIRD PARTY LOGIN

API third party.png

You've probably used web apps that asked you to log in with your Google, Facebook, Twitter, Github, or a third-party account. This technique is used to authenticate the user quickly. To see if the user is already signed in to the third-party website, the app does an API request. The API confirms the request and then handles the authentication in the app.

E-COMMERCE

ebay paypal uk.jpg

If you're familiar with online purchasing sites like Walmart and eBay, you'll see a Paypal option on your paycheck. Similar to the third-party login, The purchase order is sent to the PayPal API in the same way that the third-party login is. The Paypal application handles the rest of the transaction.

WEATHER APPS

API weather.png

You presumably have apps that you use to check the weather forecast; but, these apps do not generate this data on their own. They make use of a weather service's API, they simply send API requests to gain access to the weather service's data.

Types of an API

There are four different sorts of APIs that are typically used in web applications.

Public API

Public APIs are sometimes referred to as "free" or "open" APIs since they are provided to programmers for no cost and are always available without limits.

Partner API

Because they're not open to the public, the Partner API can only be accessed with a license.

Internal API

Also known as a private API, this type of API is solely meant to be used within a corporation to link systems and data, as well as to improve products and services.

Composite API

When two or more APIs are joined to conduct related actions at the same time, this is known as a composite API. They're typically better in performance and speed over individual APIs

Benefits of using an API

It boosts productivity

Imagine building a weather app from scratch when a service with the same functionalities is already available as an API. Instead of wasting time building up a weather service, you could just plug into an existing API and make use of those functionalities for your application. This increases productivity and eliminates unnecessary stress.

Means of revenue

Some companies use this as a source of income by monetizing their APIs. They charge customers who want to gain access to their APIs functionality.

Promotes your brand

Companies expose their APIs to also expand their reach, by using their API you're helping spread their reach to more customers. For example, if a person wants to check into a website that requires a third-party account like Github or Google to log in, they would be required to create accounts for these third-party applications.

Conclusion

According to Programmable Web, there are over 15,000 publicly available APIs excluding many thousands of private APIs that companies use.

APIs are here to stay. There are about 19.1 million API developers in the world and the trend for API developers is rising as APIs become more popular. So the big question is, how do I hook into APIs?.

Join me on Twitter if you want to learn more, I also talk about web3 and developer productivity.