What is an API?
Application program interfaces (APIs) are code that enables communication between two software programs. APIs determine how a developer requests services from an operating system or application.
The three main types of APIs are:
- Private APIs—designed to improve services and solutions within an organization. Even if the application itself is publicly available, the API is only available to developers directly employed by the publisher. Developers use private APIs to build applications or perform integration between systems.
- Partner APIs: Available to business partners who have an agreement with the API publisher. This is common for software integration between two companies. The partner who has access to the API will have access to data or certain software functions. The publisher receives a revenue stream and is responsible for ensuring that the API provides a good user experience.
- Public APIs—Also known as third-party or developer-centric APIs, are available to any third-party developer. Public APIs can be free to use or commercial:
- Open (free) APIs—all features are public and use is not restricted by terms and conditions. The API can be used to build applications without purchasing a license or subscription. All documentation related to the API is publicly available.
- Commercial APIs—use is subject to paid subscription fees or pay-as-you-go. Publishers can offer free trials so that users can evaluate the API before purchasing a subscription.
Want more technical news? Subscribe to the ComputingEdge newsletter today!
What is the API Economy?
APIs have become an increasingly important product in the development market, with over 24,000 web-based APIs currently available in the Programmable Web Directory. Companies can choose whether to provide open access to an API or restrict it to paid use. The content served through API channels can also be monetized.
The Business to Developer (B2D) model characterizes this market, with the management of business API resources known as the API economy. Some important aspects of the API economics are:
- cloud computingcloud computing makes it possible to segment software into components that can be reused, scaled and linked to requests. As a result, APIs have shifted to more complex RESTful web-centric models, as opposed to the old RPC models, which were programmer-centric. APIs are also the core of cloud automation, allowing developers to manage complex infrastructure as code.
- Integration of technologies—APIs play a key role in digital transformation, enabling the integration of disparate systems supporting different technologies. APIs also help integrate hardware components, through the Internet of Things (IoT). By bridging the gap between machine and human capabilities, APIs help AI systems and help unify processes such as RPA (Robotic Process Automation). Emerging technologies will continue to use API integrations.
- Adaptive governance—includes setting up policies for API lifecycle management. Policies used to be static rules and exceptions, but growing reliance on APIs now means processes are constantly changing. API usage is dynamic and seasonal, so governance must adapt to changing business contexts. With artificial intelligence, governance can be adjusted in line with historical data and API usage patterns.
General API Examples
Popular examples of APIs include:
- Universal login APIs:allow users to login with a single profile across multiple websites so they can be verified quickly and avoid having to set up new profiles for each service. For example, users can log in with data from their Google, Twitter or Facebook account.
- Payment Processing APIs:to allow secure payment data processing by a third party. A good example is the “Pay with PayPal” feature available for many ecommerce services. APIs allow customers to pay for purchases online, while protecting sensitive information and blocking access to unauthorized individuals.
- Travel booking comparisons—thousands of flight and accommodation options are pooled to direct users to the cheapest options for a desired destination and date. Travel websites achieve this with APIs that connect multiple sources of information.
- Video APIs—enable the implementation of joint video experiences through a website or mobile application. Users don’t have to worry about complex operations such as hosting, uploading, synchronizing and serving.
API Specifications and Protocols
API specifications standardize the exchange of data between web services. This means that different systems, using different programming languages or running on different operating systems, can communicate seamlessly with each other.
Remote Procedure Call (RPC)
The Remote Procedure Call (RPC) protocol, also known as a function or subroutine call, defines a standard procedure for exchanging resources in a client-server model. The client requests functionality or data from the server, which is on a different network or computer, and the server responds accordingly. RPC can be implemented using the SOAP messaging protocol specification.
Service Object Access Protocol (SOAP)
SOAP is a protocol specification developed by Microsoft for exchanging structured data in a distributed environment. SOAP specifies the syntax rules for application requests and responses.
SOAP compliant APIs allow systems to communicate via Extensible Markup Language (XML), or alternatively, using other protocols such as HTTP or Simple Mail Transfer Protocol (SMTP). An important aspect of SOAP is that: it has strong security measures built into the specification.
Representative State Transfer (REST)
Developers often find SOAP cumbersome to use because each task requires a lot of code to be written. A simpler alternative is REST, which follows a different logic and makes data available in the form of resources with unique URLs. To request a resource, all you need is the URL.
RESTful APIs are web APIs that comply with REST constraints. They use HTTP requests to communicate with resources. While SOAP only supports XML, RESTful systems work with a variety of formats, including HTML, XML, JSON, and plain text.
API documentation is a deliverable that comes with APIs and provides instructions for using and integrating with an API. A quick reference guide provides all the information you need to work with an API, detailing its classes, functions, return types, and arguments. It may also include tutorials and examples.
From the user’s perspective, the API is a tool for quickly integrating resources so that they can continue developing their software. Developer Experience (DX) is a developer’s total experience as they discover, learn to use, and integrate an API. API documentation is critical to improving DX.
Here are examples of excellent developer documentation:
- Twilio API Documentation—Twilio facilitates communication, provides SDKs in multiple languages, and provides sample applications for iOS, Android, and the web. The API documentation uses a three column format and the code is shown on the right. There are detailed explanations for even the simplest actions, as well as links for more information and screenshots.
- Spotify for developers—provides API documentation with demos for basic functions and fake apps, as well as wrappers for various programming languages and a console for experimentation. The console acts as interactive documentation, allowing developers to enter data and explore endpoint behavior.
- Medium API documentation—The Medium API allows third-party applications to search and post publications on Medium. It is available on GitHub and provides clear and concise instructions with plenty of examples. It covers details of all commands, with examples and possible errors. This documentation is reliable but simple, is regularly updated and allows developers to make suggestions directly in GitHub.
In this article I have covered several important aspects of APIs:
- The API Economy – widely used by businesses of all sizes to buy and sell data and services through APIs.
- API Specifications and Protocols – including the legacy RPC protocol, the SOAP protocol developed by Microsoft and the modern REST protocol.
- API documentation – an important part of the developer experience, helping developers understand how to extract value from APIs provided by other companies.
I hope this will help you as you explore how to build and use API technology.