What even are APIs?

What even are APIs?

A quick guide to the most common word in programming

2020, Mar 28    

Welcome back to What Even Is?, the series where I break down common programming concepts I keep encountering but never fully understand, until now! Today we will be looking at one of the most commonly thrown around terms in programming: API. If you are anything like me, than API is an easy word to use in a sentence, yet hard to actually define. I have built many Web APIs myself, but I realized I still didn’t fully grasp the concept. In this article, I will guide you through what I learned as I attempted to break down and API to its simplest form.

Table of Contents

Definition

API stands for Application Programming Interface. Mozilla defines and API as,a set of features and rules that exist inside a software program (the application) enabling interaction with it through software - as opposed to a human user interface. This means that at its simplest form, an API is code that governs how programs interact with a server. In other words, it is the interface between an application and a third party.

Common Usage

So, while an API can be any interface between an application and another program, the word is often used colloquially to describe a Web API. This is an interface specifically for web-based applications which, instead of returning HTML to render a Web page, returns raw data. If a standard user interacts with an application through its user interface, or website, than a 3rd party program can interact with that application though its API. The purpose of an Web API is usually to allow other applications to utilize the raw data for its own purposes. For example, I can interact with Facebook through its website, or I can use its API to access all of my information, such as friends, posts, photos, etc, as raw data which I can repurpose for use in my own programs.

Web API vs Web Application

A Web application will have to have a database to store information, a server to handle the requests to access that information, and a front-end, which displays that information in a readable, interactive web page.

A Web API will also have the database and server, but the server, rather than returning the HTML, CSS, and JavaScript which make up that front-end web page, returns the data in a format such as JSON or XML to be utilized later.


I hope you found this article helpful, and you now understand a little more about APIs. If you did, keep your eyes peeled for futures articles in the series!

References