If you have ever sent an online message, made an online payment or browsed your favorite search engine the chances are that you have already been introduced to APIs. But there’s more, so much more, to these seemingly transparent wonders.
The ‘Essentials’ series focuses on the ground-level understanding required to undertake the journey in to the world of APIs and will through the course of the series build upon your skills and introduce you to core concepts. This series is intended for people who wish to gain a rudimentary understanding of APIs such as students, new software developers and managers wishing to gain understanding and experience within their team.
We have mentioned ‘API’ a few times now, but what is an ‘API’?
In school you learnt that ‘A’ is for apple but here the acronym refers to an Application Programming Interface. It is no good to expand on just the acronym without some explanation as to its ideology or origin.
With this understanding we can begin deconstructing an API and it may be easier and more readily understood if we started with the interface.
Whether its pushing a button on our coffee machine, working on our computer or using our mobile device thousands of instructions are being sent and received between human and device and between devices themselves. To accommodate these a mechanism is required to allow for the communication to occur in a standardized, safe and predictable manner.
This is the role of the interface which exists to allow for unidirectional or bidirectional communications and allows those communications to access and execute permissible and exposed functions. In a real-world scenario this interface would exist to allow your Facebook messenger to send and receive messages between the web browser, Apple Iphone and Android devices all of which are distinctly different from each other. In another sense an interface allows an application to query the built-in GPS to determine location information by merely using a library (a collection of interfaces and functions) rather than having to be programmed to support every available GPS chipset in every handset.
An interface cannot exist however without something providing it. This is the role of the application which is written (programmed) in a specific language of choice and is usually supported by a framework (a collection of convenient functions which speed up code development). Often this framework will have built-in mechanisms for creating interfaces or provide significantly simpler means of doing so. Whatever the case the developer creates the relevant application code and functions and exposes these are interfaces either to be used internally by the same software or exposed externally for other software to use.
Software libraries (or .dll’s for the Windows aficionados) are a collection of interfaces which can be used in other applications. In time we will learn about statically linked and dynamically linked libraries as well as libraries on Windows and Linux operating systems but for now it is enough to be aware of the nature and purpose of libraries. Software libraries are convenient because it provides an essential architectural principal to developers: reusability. With low-level and high-level functions encapsulated within libraries the developer is free to create the application instead of concerning themselves with perpetually repetitive intricacies.
Now we understand an API to be an application programming interface. It is a mechanism that presents an interface to allow the safe and predictable execution of exposed and desired functionality.
APIs can take on various forms and there is no universal way in which they can be ratified. It is dependent very much on the application and the nature and purpose of its use. However in recent years standards have emerged in an attempt to give some form the way APIs are designed and documented as well as managed during operations.
Most commonly known to developers are the web API’s which govern everything from payment transactions, mobile apps and games to interactions between businesses (B2B) and consumers (B2C). Lately standards for communication between machines (M2M) govern how card payment terminals or vehicle tracking devices communication.
In time we will learn more terminology but today you can proudly exclaim that you know what an ‘API’ is!