Skip to main content

Application Programming Interface – What Is an API?

An Application Programming Interface (API) is a connection mechanism that allows two independent software to connect and communicate with each other.

In other words, an API serves as an intermediary to convey messages from one app to the other and vice versa.

Note the following:

  • An interface means connection.
  • A user interface (UI) is a connection mechanism that allows communication between humans and computers. Examples are keyboards, mouses, and ATMs.
  • A hardware interface is a connection mechanism that allows communication between two or more hardware devices. USB, VGA, and Ethernet are examples of hardware interfaces.
  • An application programming interface is a connection mechanism that allows communication between multiple software programs, apps, or hardware devices. Twitter API, Google Maps API, and Amazon API are examples of application programming interfaces.

How Does an API Work?

An API works like a waitress who acts as an intermediary between a customer and a restaurant's kitchen.

Diagram illustrating how an API
works

An API takes requests from the caller to the publisher and returns a response

  1. The customer (caller) calls the waitress (API) to request a burger (data) from the kitchen (publisher).
  2. The waitress (API) relates the customer's (caller's) request to the kitchen (publisher).
  3. The kitchen (publisher) responds by giving the waitress (API) the requested burger (data).
  4. The waitress (API) returns to the customer (caller) with the requested burger (data).

A caller is an app desiring to access another software's feature. And a publisher is an application containing the caller's request.

In other words, a publisher (like Google) provides APIs (software intermediaries) to help you retrieve specific features from its server—which you cannot access directly.

For instance, suppose you wish to display tweets on your website. In that case, you have no direct access to the servers hosting the tweets. However, Twitter provides the Twitter API, which you can use to retrieve the tweets.

note

Most publishers require you to sign up and get an API key before you can use their APIs.

Types of APIs

The four types of APIs are:

  • Database APIs
  • Operating system APIs
  • Remote APIs
  • Web APIs

What is a Database API?

Database APIs connect a caller to the resources and services of a database management system. Snowflake SQL API, Drupal database API, and ORDS database API are typical examples of database APIs.

What is an operating system API?

Operating system APIs connect a caller to the resources and services of an operating system. Windows API, Android API, and Linux API are examples of operating system APIs.

What is a remote API?

Remote APIs connect a caller to the resources and services of a remote system.

In other words, a remote API facilitates the exchange of information between two apps on different devices. Java Database Connectivity API and Java Remote Method Invocation API are examples of remote APIs.

What is a web API?

Web APIs connect a caller to the resource and services of a web-based system.

In other words, web APIs are code—such as properties, methods, events, and URLs—that you can use in your app to access the components of a browser, local app, hardware, or remote system.

Google Maps API, DOM API, Web Storage API, Canvas API, and Fetch API are examples of web APIs.

Note the following:

  • Web APIs are also remote APIs, but the reverse is only sometimes so. Only remote APIs that use HTTP servers can also be called web APIs.
  • Browser APIs are the web APIs web browsers publish to allow access to the browser's built-in features.
  • Third-party APIs are the web APIs third parties platforms (such as Pinterest, Facebook, and MapQuest) publish to allow access to the platform's features.
  • Web API is sometimes called Web Service API.

Now that we know the four types of APIs let's understand their release policies.

What Is an API Release Policy?

An API release policy defines an API's availability and usage guideline.

In other words, people (or organizations) release APIs based on four policies:

  • Internal
  • Public
  • Partner
  • Composite

Let's discuss the four types of release policies now.

What is an internal API release policy?

An internal API release policy allows publishing APIs for internal use only.

An application programming interface with an internal release policy is unknown to third parties because they remain private within the organization.

In other words, internal APIs are used solely by the publisher's development teams to help improve their products and services.

note

Internal APIs are sometimes called private APIs.

What is a public API release policy?

A public API release policy allows publishing APIs for public use.

Public APIs are typically categorized as open or commercial.

  • Open APIs are freely available for public use.
  • Commercial APIs are available to the public on pay-as-you-go or subscription fee terms.

In other words, not all public APIs are available for free. Although, some publishers do offer free trials on their commercial APIs.

What is a partner API release policy?

A partner API release policy allows publishing APIs to partner companies only.

In other words, partner APIs are accessible only to partners having an agreed business relationship with the API's publisher.

What is a composite API release policy?

A composite API release policy allows publishing APIs to help unify multiple data or service APIs.

In other words, composite APIs help developers access multiple endpoints in a single call—for instance, in microservices architecture, where you need to retrieve data from various apps to accomplish a single task.

Overview

This article discussed APIs, how they work, and the four types. We also discussed the release policies guiding the availability and use of an application programming interface.

Useful Resources

Below are links to other valuable content on application programming interfaces.

Your support matters: Buy me a coffee to support CodeSweetly's mission of simplifying coding concepts.

Tweet this article