API is the acronym for Application Programming Interface, a software intermediary that allows two applications to talk to each other. So each time you use an app like Facebook, send an instant message or check the weather on your phone, you’re using an API. This guide will explain what an API is and everything you need to know.
When you use an application on your mobile phone, the application connects to the Internet and sends data to a server. The server then retrieves that data, interpret it, and presents you with the information you want in a readable way. All of this happens via API.
For instance, when you type www.facebook.com into your browser, a request goes out to Facebook’s remote server. Once your browser receives the response, it interprets the code and displays the page.
Facebook’s server is an API to the browser, also known as the client. This means that you interact with some remote server’s API every time you visit a page on the Web.
An API isn’t the same as a remote server. Instead, it is the part of the server that receives requests and sends responses.
However, what if you are not using the airline’s website, a channel that has direct access to the information? What if you use an online travel service, such as Kayak or Expedia, which aggregates data from several airline databases?
The travel service, in this case, interacts with the airline’s API. The API is the interface that, like your helpful waiter, can be asked by that online travel service to get information from the airline’s database to book seats, baggage options, etc. The API then takes the airline’s response to your request and delivers it right back to the online travel service, showing you the most updated, relevant information.
APIs serve numerous purposes. Generally, they can simplify and speed up software development. Developers can add functionality (i.e., recommender engine, accommodation booking, image recognition, payment processing) from other providers to existing solutions or build new applications using services by third-party providers. In all these cases, specialists don’t have to deal with source code to understand how the other solution works. Instead, they connect their software to another one. In other words, APIs serve as an abstraction layer between two systems, hiding the complexity and working details of the latter.
APIs have become so valuable that they comprise a large part of many businesses’ revenues. Major companies like Google, eBay, Salesforce.com, Amazon, and Expedia are just a few companies that make money from their APIs. What the “API economy” refers to is this marketplace of APIs.
You’ve probably heard of companies packaging APIs as products. For example, Weather Underground sells access to its weather data API.
Example scenario:Your small business’s website has a form to sign clients up for appointments. You want to give your clients the ability to automatically create a Google calendar event with the details for that appointment.
API use:The idea is to have your website’s server talk directly to Google’s server with a request to create an event with the given details. Your server would then receive Google’s response, process it, and send back relevant information to the browser, such as a confirmation message to the user.
How is this Google Calendar’s API different from any other remote server’s API?
In technical terms, the difference is the format of the request and the response.
Your browser expects a response in HTML containing presentational code to render the whole web page, while Google Calendar’s API call would return the data, likely in a format like JSON.
If your website’s server is making the API request, then your server is the client (similar to your browser being the client when you use it to navigate a website).
APIs allow you to complete the action without leaving your website from your user’s perspective.
To summarize, when a company offers an API to their customers, it just means that they’ve built a set of dedicated URLs that return pure data responses, meaning the responses won’t contain the kind of presentational overhead that you would expect in a graphical user interface like a website.
Can you make these requests with your browser? Often, yes. Since the actual HTTP transmission happens in text, your browser will always do its best to display the response.
APIs can be a private, partner, and public in terms of release policies.
These application software interfaces are designed to improve an organization’s solutions and services. In-house developers or contractors may use these APIs to integrate a company’s IT systems or applications, build new systems, or customer-facing apps leveraging existing systems. Even if apps are publicly available, the interface remains available only for those working directly with the API publisher. The private strategy allows a company to control API usage fully.
Partner APIs are openly promoted but shared with business partners who have signed an agreement with the publisher. The common use case for partner APIs is software integration between two parties. A company that grants partners access to data or capability benefits from extra revenue streams. At the same time, it can monitor how the exposed digital assets are used, ensure whether third-party solutions using their APIs provide a decent user experience, and maintain corporate identity in their apps.
Also known as developer-facing or external, these APIs are available for any third-party developers. In addition, a public API program allows for increasing brand awareness and receiving an additional source of income when properly executed.
There are two types of public APIs: open (free of charge) and commercial ones.
- The Open API Definition suggests that all features of such an API are public and can be used without restrictive terms and conditions. For instance, it’s possible to build an application that utilizes the API without explicit approval from the API supplier or mandatory licensing fees.
- Commercial API users pay subscription fees or use APIs on a pay-as-you-go basis. A popular approach among publishers is to offer free trials, so users can evaluate APIs before purchasing subscriptions.
Over the years, an “API” has often described any generic connectivity interface to an application. More recently, however, the modern API has taken on some characteristics that make them extraordinarily valuable and useful.
Modern APIs adhere to standards (typically HTTP and REST) that are developer-friendly, easily accessible, and understood broadly. They are treated more like products than codes. They are designed for consumption for specific audiences (e.g., mobile developers), documented, and versioned so that users can have certain expectations of their maintenance and life cycle. Because they are much more standardized, they have a much stronger discipline for security and governance and are monitored and managed for performance and scale.
APIs can be classified according to the systems for which they are designed.
Database APIs enable communication between an application and a database management system. Developers work with databases by writing queries to access data, change tables, etc. The Drupal 7 Database API, for example, allows users to write unified queries for different databases, both proprietary and open-source (Oracle, MongoDB, PostgreSQL, MySQL, CouchDB, and MSSQL).
Another example is ORDS database API, which is embedded into Oracle REST Data Services.
This group of APIs defines how applications use the resources and services of operating systems. Every OS has its set of APIs, for instance, Windows API or Linux API (kernel–user-space API and kernel internal API).
Apple provides API references for macOS and iOS in its developer documentation. APIs for building applications for Apple’s macOS desktop operating systemare included in the Cocoa set of developer tools. Those building apps for the iOS mobile operating system use Cocoa Touch, a modified version of Cocoa. Remote APIs define standards of interaction for applications running on different machines. In other words, one software product accesses resources located outside the device that requests them, which explains the name. Since two remotely located applications are connected over a communications network, particularly the internet, most remote APIs are written based on web standards.
Java Database Connectivity API and Java Remote Method Invocation API are two examples of remote application programming interfaces.
This API class is the most common. Web APIs provide machine-readable data and transfer functionality between web-based systems, representing client-server architecture. These APIs mainly deliver requests from web applications and responses from servers using Hypertext Transfer Protocol (HTTP).
Developers can use web APIs to extend the functionality of their apps or sites. For instance, the Pinterest API comes with tools for adding users’ Pinterest data like boards or Pins to a website. Likewise, Google Maps API enables the addition of a map with an organization’s location.
The goal of API specifications is to standardize data exchange between web services. That is the ability of diverse systems, written in different programming languages and/or running on different OSs, or using different technologies, to communicate with each other seamlessly.
From what we have covered, I hope you take away the broader meaning of API and the more common uses of the term today.
Editor’s picks: