What is an API? How the Internet Works Behind the Scenes

What is an API? How the Internet Works Behind the Scenes

API have revolutionized the way that we use web and mobile applications by allowing computer programs to talk to each other.

Introduction

APIs, or “Application Programming Interfaces,” are the hidden backbone of our modern world which allow software programs to communicate with one another. Although most of us don’t know it, behind the scenes of every app and website we use is a mesh of computers “talking” to each other through a series of APIs.

Today, the “API economy” is quickly changing how the world interacts. If you already write software, you are probably familiar with APIs. But the rest of you may be wondering: what exactly are APIs and why are they so important?

APIs: The Backbone of Software

An API is a set of rules that dictate how one application communicates with another. APIs aren’t that new either; whenever you use a PC, APIs are what makes it possible to move data between different applications.

On the web, you can think of APIs like a telephone system: when one application wants to get information from another, it gets that data by “calling” the second application’s API.

Figure 1 shows how this works: a user accesses a website, and the website then calls Facebook’s API to get the data it wants.

1_AmUAIuwgWiY0TfWRcS0Rsw.png

In the Web API world, big services like Facebook, Google Maps, Foursquare, and others allow smaller apps to “piggyback” on their data. For example, many applications let users “sign in with Facebook”, which all happens through Facebook’s API. Many websites show locations on Google Maps, which Google allows through their Google Maps API.

APIs do all of this by exposing a piece of the software’s internal data and functionality to the outside world in a controlled way. That allows for one application to share data and perform actions on one another’s behalf without requiring software developers to share all of their code. Sharing code at that scale would be massively inefficient in addition to posing major security threats. APIs allow for this type of integration without sharing the actual code that makes the software run. APIs are useful even for open-source software (where the code is freely and publicly available): most developers don’t have the time or patience to look through thousands of lines of code just to use one piece of functionality. Instead, that functionality can be offered through an API.

Without APIs, applications would be incredibly disconnected and therefore confusing. APIs allow applications to talk to each other, and therefore for more innovative and consistent applications to be built.

Why APIs are Important

Because they explain how software developers can engineer new apps that plug into big services: social networks like Twitter and Facebook, or utilities like Dropbox or AccuWeather.

The maker of a mobile game, FlappyBird for instance, could use Dropbox to let players store their games and preferences in Dropbox’s cloud instead of building out a cloud storage system from scratch.

APIs can therefore be huge timesavers for both software developers and users. Without the Github API for instance, users would have to create a separate username and password for every application instead of having the ability to “log in through Github” (which uses the Github API). For example, when you use your iPhone to search for nearby bars on Yelp, the app plots their locations on an Apple Map instead of trying to create their own map from scratch. This all works through an API.

APIs are extremely pervasive and have allowed the pace of innovation to increase rapidly, where each new software developer can create functionality without having to reinvent the wheel.

API Business Models

1_oJWbJB92cFVnvVrBF6U9Ig.png

APIs are often used by companies to make money. Above shows 4 common API business models that allow companies to further business objectives via their APIs. The term “Developer” in the figure refers to the software developer that would be utilizing the API.

In a free API, a company or organization gives away access to an API at no cost, either because having software developers using the API spreads the reach of the company and may allow the company to reach more users because the API is simply free and open source. In a “developer pays” model, the API, or the data provided through it, is so valuable, that a software developer is willing to pay for access.

Examples of this include PayPal, which charges for access to its payments API because it makes accepting payments online much simpler. PayPal then charges a transaction fee for each payment made through its API. In a “developer gets paid” model, a company may pay a developer for using its API.

This often comes as part of an affiliate program or revenue-share program whereby a developer using the API (e.g. Amazon’s) can get paid for every “lead” she sends to Amazon.com through the API. “Indirect” models cover all of the other possible ways for companies to benefit from APIs.

An API is a Promise

A major issue with APIs is that they aren’t necessarily permanent. Just because a company is making an API available now doesn’t necessarily mean it will be available tomorrow.

Twitter infamously limited third-party access to its API at the end of 2012. This had the effect of killing all alternative Twitter clients and forcing users to use Twitter’s official apps and website, where Twitter can show users ads as it pleases but for many developers who relied on the Twitter API, it meant shutting down their business because of Twitter’s decision.

Since web APIs are still in their infancy, there is still a lot to learn. One of the things API providers should understand is that an API is a promise: once other people are relying on it, it is crucial maintain it and keep it active.

APIs and Innovation

The good news is that for the most part, APIs encourage innovation and don’t stifle it. Without APIs, communication between apps would be stifled, software developers would continuously be re-writing software that performed the same functionality, and generally innovation would slow.

Government released data.gov.in, which is a set of thousands of APIs that allow the public to access information about government resources ranging from healthcare to finances to agriculture. This has allowed developers to create apps to support their neighborhoods and fellow citizens: from apps to help find polling places to ones that give information on food safety, and none of this would have been possible without APIs.

As the world moves further and further into the technical revolution, APIs will have an even bigger role powering the apps and websites we use every day.

Thanks for reading. Feel free to share your insights.