An application programming interface (API) is code that enables two software programs to communicate. An API defines how an API developer should request services from an operating system (OS) or other application, and expose data within different contexts and across multiple channels.
Any data can be shared with an application programming interface. APIs are implemented by function calls composed of verbs and nouns; the required syntax is described in the documentation of the application being called.
For example, on a real estate website, one API might publish available real estate properties by geography, while a second API provides current interest rates and a third offers a mortgage calculator.
In the early days of Web 2.0, the concept of integrating data and applications from different sources was called a mashup.
The web, software designed to exchange data via the internet and cloud computing have all combined to increase the interest in APIs and services.
How do APIs work?
APIs are made up of two related elements:
- a specification that describes how information is exchanged between programs in the form of a request for processing and a return of the necessary data; and
- a software interface written to that specification and published in some way for use.
The software that wants to access the API is said to call it, and the software that creates the API is said to publish it.
APIs authorize and grant access to data that users and other applications request. Access is authenticated to a service using predefined roles that govern who can access specific actions and data.
APIs also provide an audit trail that details who and what have had system access and when it happened.
Applications that call APIs were traditionally written in specific programming languages. Web APIs can be called through any programming language. Web pages created in Hypertext Markup Language (HTML) or application generator tools can also access them.
The most common architectures for APIs are Representational State Transfer (REST) and Simple Object Access Protocol (SOAP). They define a standard communication protocol specification for a message exchange based on Extensible Markup Language or XML.
SOAP requires less low-level infrastructure-related code than REST. However, REST APIs are easier to scale and redeploy, and simpler to implement and integrate with websites and services. REST APIs are most often used today, particularly for web interactions.