An application programming interface, commonly referred to as an API, is an interface that allows two different applications to ‘talk’ to each other by exchanging messages across well-defined channels. APIs simplify development by abstracting the finer workings under the external surface and allowing only pre-defined objects and actions.
The most common implementations of APIs is one wherein the relationship between the applications is that of a provider-consumer. Among other things, the API provider must document:
Web APIs are a class of APIs that operate over the internet carried over HyperText Transfer Protocol. These APIs co-opt internet protocols and conventions such as
Authorization headers for authentication and request/response bodies for data transfer.
These APIs provide fixed, usually versioned, endpoints allowing reading and, optionally, writing data. The newer REST architecture for stateless services has all but replaced the previously favored SOAP architecture.
Web APIs are also the backbone of the microservices architecture where distinct components of a system work independently, exchanging data via interconnected APIs. Using APIs, each service only exposes a few endpoints while neatly abstracting away implementation details from all other components in the system.