What is an API?
An Application Programming Interface (API) is a set of functions that allows applications to access data and interact with external components. An API is essentially a courier that delivers messages from a client to a server and vice versa.
More About APIs
Your phone’s weather app is a perfect example of an API in action. The app obtains data from sources, such as The Weather Channel, via APIs.
APIs can work in four ways:
- Simple Object Access Protocol (SOAP) API. The client and server exchange messages using XML. This is a technique that was popular in the past.
- Remote Procedure Calls (RPC) API. The client completes a function on the server, and the server sends the output back to the client.
- Websocket API. A two-way communication between the client and the server, where the server sends callback messages to the client.
- Representational State Transfer (REST) API. The client sends a request to the server as data. The server then uses this data to complete internal functions and returns output data to the client. This is the most popular technique.