API
What is an API?
An 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.
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. This is called interoperability.
How APIs Work
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.
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.
A Little History
The idea of APIs started in the 1940s, but the name “API” became popular in the 1960s and 70s. 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.
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.
Different Types of APIs
APIs 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.
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.
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.
Examples of APIs
Some examples of APIs include:
- Cocoa and Carbon for the Macintosh
- DirectX for Microsoft Windows
- 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.
