API
Adapted from Wikipedia · Discoverer experience
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 designed for computer programmers who build and connect software.
APIs help hide the complicated inner workings of a system, showing only the parts that programmers need. This makes it easier to update or change the system without affecting the programs that use it. They can be built for specific uses or follow common standards so many different systems can work together, a process called interoperability.
Today, many APIs are called web APIs, letting computers communicate over the internet. But APIs also exist for programming languages, software libraries, operating systems, and even 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 (called an API call), and the sensor sends back the weather report (called an API response).
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 at first only talked about ways for regular programs that people used to work. But now, it talks about 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 itself. In the 1940s, computer experts Maurice Wilkes and David Wheeler made a set of helpful pieces of code for an early computer called EDSAC. They kept notes on how to use each piece, which is a lot like what we call 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 a paper in 1968 about how graphics programs talk to computers. Later, in 1974, a writer named C. J. Date used it for databases. By 1990, experts said an API was just a set of services that help programmers do tasks.
When computers started talking to each other over networks, APIs changed again. In 2000, a writer named Roy Fielding talked about web APIs, which let programs on different computers talk. Today, web APIs are the most common kind, helping all kinds of data move across the internet.
Types
Libraries and frameworks
The way a software library works is one kind of API. The API tells us what the library should do, while the library itself is the actual code that makes it happen.
One API can have many different libraries that all follow the same rules. This lets programs written in one language use libraries written in another. For example, because Scala and Java can work together, Scala can use any Java API.
APIs can be used in different kinds of programming languages. An API for a procedural language like Lua might focus on basic tasks, while an API for an object-oriented language like Java would talk about classes and their class methods.
Operating systems
An API can be the link between an app and 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 because it affects how people use it. Good design helps make software easier to use by hiding the complicated parts inside. This way, people can use the tools they need without worrying about the details. Designing APIs well is a key part of building big and complex software systems.
Release policies
APIs help different technology companies work together. Companies that create and use APIs are part of a shared business world.
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. This helps the company control quality and earn more money.
- 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. Not all public APIs are open to everyone. Internet services like Cloudflare or Voxility use special APIs for customers and resellers to see information about their service. Access is given using special codes or by checking customer status.
API documentation
API documentation tells developers what services an API offers and how to use them. It includes everything needed to work with the API effectively.
This documentation is very important for building and keeping applications that use the API. You can find it in traditional files or even on social media like blogs and forums. It may include examples, guides, and explanations of how things work, 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 took legal action against Google for using a version of Java in the Android operating system without permission. A judge decided that APIs cannot be owned under copyright law in the U.S. However, this decision was later changed.
In 2016, a jury decided that Google's use of the Java API was allowed, but the decision was challenged again. In 2019, Google took the issue to the highest court in the United States, and in the end, 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)
Images
Related articles
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.
Safekipedia