An application programming interface, or API, is a piece of code that allows two applications to share information.
A good example of an API is an aggregator site for hotel bookings. The aggregator site uses APIs to request information from different hotel chains in response to a customer’s request.
For example, the customer requests information on available rooms that meet specific criteria – the start and end date for the stay, geographical area, cost. This information is sent to the hotel’s systems using an API, which translates the request into a format which the hotel servers can understand. These systems then reply through the API with the rooms they have available that match these criteria.
The API enables the information to be exchanged quickly and easily despite the aggregator site and the hotel system being built with different technology and by different companies.
In this scenario, the hotel is the API provider. It has built the API to enable other Apps to access the information. The hotel does this because it wants to make it easy for users to find out about its available rooms. The aggregator site is the consumer of the API. It uses the API because it would be either impossible or too much work to obtain the data it needs without one.
APIs help developers to use existing functionality and data rather than using a workaround or building it themselves. For instance, by using the Google Maps API to show the location of a store or restaurant, the developer avoids the need to draw or code map functionality from scratch. This saves considerable time and money.
APIs exist wherever different pieces of software need to interact, and because making data available is good for business, many of them are free to use.
Blockchain, for example, provide free APIs that enable developers to access Bitcoin payment processing, wallet services, transaction data, and market data for use on their websites and applications.
Cryptocurrency exchanges also provide APIs. Traders can use these APIs to supply market data to trading bots, enabling them to make trades (according to preset instructions) on behalf of the traders. This form of trading is known as algorithmic trading (or bot trading).