The Economist explains

What APIs are

By E.A.H.

A FEDERAL jury has handed Google a huge victory in its long-running battle with a rival, Oracle, over Google’s Android software. The two software giants have been at legal loggerheads for years over Oracle’s allegation that Google illegally copied parts of its software—specifically, 37 “Java APIs”—in its Android phones. Oracle has already announced it plans to appeal. But what is an API?

An API (short for “Application Program Interface”) is a standard way for programmers to work with code written by others—a bit like a postbox is a standard way for sending letters. To use a postbox, you drop your addressed, stamped envelope into it, and expect the post office to take care of the rest. The addresses and stamps are standard. You don’t mind how the letter gets from the postbox to its destination, only that it does so. The system saves you the trouble of figuring out how to get the letter there yourself. APIs perform much the same function: they let programmers perform common tasks. APIs generally perform a group of related tasks: for example, the “java.io” API, one of those at issue in Oracle’s suit, has pieces to read and write files, and to perform other file-related tasks.

APIs are important because without them developers would have to write a lot of routine code on their own. Java programmers would each have to write (or find) their own script to read and write files. This would not only be time-consuming, but some would get it wrong, causing errors later on. Consequently, developers rely on APIs for many tasks. For example, the content of this article is stored in a database; for you to see it, the website’s code called the database API to fetch it out; if you add a comment, the website will call the same API to record it. In much the same way, APIs allow websites to work together in ways that would otherwise be difficult or impossible. If you tap the “Like” button at the top of this article, it is Facebook’s API that allows it appear in your feed. APIs hook together all sorts of web services, from Twitter to Dropbox to Google to Paypal. These APIs don’t depend on the internal workings of the services themselves: Google can change how it searches the web, but so long as the API remains the same, Siri can still fetch Google results for you.

At the root of the Oracle v Google case is whether it was proper for Google to copy Java’s API. Google (with a few small exceptions) did not copy code from Oracle, but they did copy the way that developers access those functions. To extend the previous analogy, this would be like Federal Express creating their own postboxes, which could take exactly the same addressed, stamped envelopes as a normal postbox and see the letters to their destinations, using FedEx’s delivery system (rather than the post office’s). Oracle has successfully argued in court that they hold copyright of the Java API, but Google maintains that their copies are “fair use”, as they created a new, different and “transformative” work of their own. The jury agreed. Some feared that a guilty verdict would have a chilling effect on developers, discouraging them from making APIs compatible with those of other software. But fair use is a case-by-case decision: although Google has been found innocent in this instance, other developers may not be in the clear. Still, with tens of thousands of APIs in use in software of all sorts, many programmers are breathing a little easier today.

Discover more

How to define artificial general intelligence

Academics and tech entrepreneurs disagree. A court may soon decide

Gaza could face a famine by May. What does that mean?

Some parts of the strip are already experiencing “catastrophic hunger”


What is the Islamic State Khorasan Province?

The group that claimed responsibility for the Crocus City Hall attack is a growing threat to Russia—and the West