API
An application programming interface (API) is a special way for different computers or computer programs to talk to each other. Think of it like a bridge that connects software pieces so they can share information and work together smoothly. Unlike a regular user interface that people use, an API is for computer programmers who build and connect software.
APIs hide the complicated parts of a system, showing only what programmers need. This makes it easier to update or change the system without affecting other programs. APIs can be made for specific uses or follow common rules so many systems can work together, a process called interoperability.
Today, many APIs are web APIs, letting computers talk over the internet. APIs also exist for programming languages, software libraries, operating systems, and computer hardware. The idea of APIs started in the 1940s, but the name “API” became popular in the 1960s and 70s.
Purpose
An API helps different parts of a computer system talk to each other. It works like a secret handshake that lets software programs share information and work together. You can't see an API, but it makes things happen behind the scenes.
Think of building with Lego bricks. Each brick is like a piece of software. APIs help these pieces fit together to build something new. For example, a weather app might use an API to ask a weather sensor for the day's forecast. The app sends a message, and the sensor sends back the weather report.
APIs are like agreements between the person who makes the software and the people who use it. When the rules of the API stay the same, developers can trust and use it more often.
History of the term
The word API used to mean ways for everyday programs to work. Now, it includes all kinds of helper programs and even ways for machines to talk to each other.
The idea of an API is older than the word. In the 1940s, computer experts Maurice Wilkes and David Wheeler made helpful pieces of code for an early computer called EDSAC. They kept notes on how to use each piece, which is like an API today. Their book, The Preparation of Programs for an Electronic Digital Computer, had the first published API guide.
The words “application program interface” were first used in 1968 in a paper about graphics programs talking to computers. Later, in 1974, a writer named C. J. Date used it for databases. By 1990, experts said an API was a set of services to help programmers.
When computers started talking to each other over networks, APIs changed. In 2000, a writer named Roy Fielding talked about web APIs, which let programs on different computers talk. Today, web APIs are very common, helping data move across the internet.
Types
Libraries and frameworks
A software library is one kind of API. The API tells us what the library should do, and the library is the code that does it.
One API can have many libraries that all follow the same rules. This lets programs in one language use libraries in another. For example, Scala and Java can work together, so Scala can use any Java API.
APIs work with different kinds of programming languages. An API for a procedural language like Lua might focus on simple tasks, while an API for an object-oriented language like Java would talk about classes and their class methods.
Operating systems
An API can connect an app to the operating system. POSIX is an example—it gives common APIs so an app that works on one POSIX system can also work on another.
Linux and Berkeley Software Distribution are examples of operating systems that use POSIX APIs.
Remote APIs
Remote APIs let developers work with resources far away using special rules for communication, called protocols. For example, the Java Database Connectivity API lets developers work with many types of databases using the same functions. Remote APIs help keep things simple in object-oriented programming by letting local actions affect remote objects.
Web APIs
Main article: Web API
Web APIs are the ways that businesses let apps use their services. They often use web development standards like Hypertext Transfer Protocol (HTTP) and formats like XML or JSON.
For example, a shipping company might offer an API so a website can easily add shipping services and show current rates, without the website builder having to add the rates manually. Web APIs can combine many different services into new apps, called mashups. They also help social media sites share content across the web. For example, Twitter’s API lets developers work with Twitter data and search trends.
Design
The design of an API is very important. It helps people use software more easily by hiding the complicated parts. This lets users focus on what they need without worrying about the details. Good API design is key for building big and complex software systems.
Release policies
APIs help different technology companies work together.
There are three main ways to share an API:
- Private: Only used inside the company.
- Partner: Only certain business partners can use it. For example, ride services like Uber and Lyft let approved developers order rides through their apps.
- Public: Available for anyone to use. For example, Microsoft makes the Windows API public, and Apple shares its Cocoa API so software can be made for their platforms.
API documentation
API documentation explains what services an API offers and how to use them. It gives everything needed to work with the API well.
This documentation is important for building and keeping applications that use the API. You can find it in files or on social media like blogs and forums. It may include examples and guides, but it usually does not show the inner details of the API itself.
Dispute over copyright protection for APIs
Main article: Google LLC v. Oracle America, Inc.
In 2010, Oracle Corporation said Google used part of Java in Android without permission. A judge decided that APIs could not be owned under copyright law in the U.S., but this decision was later changed.
In 2016, a jury said Google could use the Java API, but this was challenged again. In 2019, Google took the issue to the highest court in the United States, and the court ruled in favor of Google.
Examples
Main category: Application programming interfaces
Some examples of APIs include:
- ASPI for connecting to SCSI devices
- Cocoa and Carbon for the Macintosh
- DirectX for Microsoft Windows
- EHLLAPI
- Java APIs
- ODBC for Microsoft Windows
- OpenAL for sound on many systems
- OpenCL for using both CPUs and GPUs for computing tasks
- OpenGL for creating graphics on many systems
- OpenMP for multi-processing programming in C, C++, and Fortran
- Server application programming interface (SAPI)
- Simple DirectMedia Layer (SDL)
Pictures
Keep exploring
This article is a child-friendly adaptation of the Wikipedia article on API, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.
