It’s been a while since we talked much about APIs in this space, so it’s probably time we revisited the topic. APIs (short for application programming interfaces) are becoming more important in software development all the time, so it’s a good idea for both techies and their customers to have a little refresher on what APIs are, how they work, and why they’re so important these days.
APIs: A Recap
At its most basic, an API is a set of programming objects (variables, or properties, and procedural code, or methods), routines, and communication protocols that help a software developer take advantage of an existing system, such as a piece of hardware, web-based system, operating system, database, or another system. APIs “hide” the fussy low-level minutiae of making these third-party things work with the program you’re developing. (We call this abstraction.)
For example: Suppose you’re developing software to automate some functions of a warehouse and distribution center, and you need to make the system work with a commercially available barcode scanner device, perhaps one attached to the side of a conveyor belt that scans boxes as they roll by. Although small in size, a barcode scanner can be an extremely complex piece of hardware. If you had to program every last iota of the device’s functionality, the process could take months and be a nightmare to debug.
However, with the API that the device manufacturer provides (if they know what’s good for them), the programmer’s job is much simplified. There’s probably a call to an initiation routine, where you tell the device what barcode format(s) to expect, how fast to transmit the decoded data, whether any characters need to be transformed or ignored, and so on. A different call actually tells the device to read whatever barcode is in front of it and send the decoded and processed data back to the program. Easy peazy.
How APIs Work
Let’s dive a little deeper into how APIs work: How they’re developed and distributed, and how a programmer uses them to develop software.
From an API development standpoint, the development team needs to decide what functionality to expose in the API and what is to remain off-limits. This can be a delicate balance: You want to expose enough to make the API useful to third-party application developers, but not so much that they can create applications that compete with your own in the marketplace.
As if that weren’t tricky enough, an API needs to be nearly 100% stable from its initial release; if some behaviors are changed or eliminated in subsequent versions, some existing applications using the API may stop functioning correctly. It’s considered good practice to clearly document those features that are not fully cooked as “unstable” or “beta” features that developers use at their risk.
On a related note, for an API to be at all useful to anyone, it needs to be completely and thoroughly documented. Every object, property, and method should be written up in a way that shows how to use it and leaves no ambiguity. Because developers generally aren’t very good at documentation, this task is often left to a technical writer who specializes in APIs.
Finally, the design of an API is important. APIs can be designed to be used with any programming language or may be language-specific. This is often a business decision, but may be driven by technical constraints as well.
Release considerations include the type of release and licensing issues. There are three basic types of APIs:
- Public - Released for any developer to use
- Partner - Released for use by specific third parties. This enables exclusive agreements between hardware manufacturers and application developers.
- Private - Released for internal company use only
In addition, the API owner needs to consider the licensing terms and what, if anything, to charge for access to the API. Overly restrictive terms might defeat the purpose of the API in the first place. Public API license terms vary widely, and third-party development teams should examine an API’s license carefully for conditions and restrictions that could make it unsuitable for the project they’re undertaking.
For the third-party developer using the API, if the licensing terms are acceptable, it’s time to obtain the API, review the documentation, and start designing and coding.
How one “obtains an API” depends on the API. Some are downloaded to the development machine for use in the development environment. For others, such as APIs that provide access to cloud-based database content, “obtaining an API” means registering on the API owner’s website as a developer and obtaining an “API key,” which is used in the HTTPS query string when requesting specific content from the database.
For widely used APIs, there is normally a community of developers that support each other with tips, tricks, examples, and pitfalls to avoid when using the API. Some API owners offer support, others don’t. In some cases, the third-party developer is left to trial and error when learning how to use the API. Such is the life of a developer.
The Growing Importance of APIs
In the old days, complex systems were often built from the ground up by a single manufacturer who provided all the hardware and software. There was a certain advantage to this approach: There was “one throat to choke” if something went wrong. However, once you bought a system like this, you were locked into a single provider, and it could be difficult to maintain or modify the system.
Eventually, the industry learned that this was a highly inefficient way of doing things; it’s better to be able to source components and subsystems from different providers in order to build a system that meets all the requirements for less money and in less time. APIs are what enabled this revolution.
APIs will continue to grow in importance, driven by the following technology trends, among others.
- Internet of Things (IoT): Thousands upon thousands of different types of devices, such as sensors, actuators, cameras, displays, audio interfaces, and more, will be connected to the internet in myriad configurations. Every one of them will need an API to get it to interact with other systems and devices.
- Artificial intelligence (AI): Pre-trained, cloud-based AI systems are already available and continue to find new uses in areas such as medicine, food safety, security, finance, and more. Many such systems will have APIs associated with them so that system developers can leverage these technologies without building them from scratch or hosting them on local servers.
- Robotics: Not only will complete robots themselves have APIs, but individual robot components (sensors, manipulators, mobility subsystems, vision components, and so on) will have APIs so that custom robots can be designed, built, deployed, and controlled more easily.
It’s no coincidence that these three areas are among those that we are most excited about here at AndPlus—APIs enable us to leverage many emerging technologies to provide high-quality, robust solutions to our clients.