What is an API? Application programming interfaces explained

Updated: Jul 1

API is the acronym for Application Programming Interface, which is a software part that allows two applications to talk to each other. Whenever we use an app like Twitter, whats-app, send an instant message, or check the temperature on our phone, we’re using an API.

An API can be entirely custom, specific to a component, or it can be designed based on an industry-standard to ensure interoperability. Through information hiding, APIs enable modular programming, which allows users to use the interface independently of the implementation.

Purpose of API

An API (application programming interface) simplifies programming by abstracting the underlying implementation and only exposing objects or actions the developer needs. While a graphical interface for an email client might provide a user with a button that performs all the steps for fetching and highlighting new emails, an API for file input/output might give the developer a function that copies a file from one location to another without requiring that the developer understand the file system operations occurring behind the scenes.

Remote APIs

Remote APIs allow developers to manipulate remote resources through protocols, specific standards for communication that allow different technologies to work together, regardless of language or platform. For example, the Java Database Connectivity API allows developers to query many different types of databases with the same set of functions, while the Java remote method invocation API uses the Java Remote Method Protocol to allow invocation of functions that operate remotely, but appear local to the developer.

Therefore, remote APIs are useful in maintaining the object abstraction in object-oriented programming; a method call, executed locally on a proxy object, invokes the corresponding method on the remote object, using the remoting protocol, and acquires the result to be used locally as a return value.

Web APIs

Web APIs are the defined interfaces through which interactions happen between an enterprise and applications that use its assets, which also is a Service Level Agreement (SLA) to specify the functional provider and expose the service path or URL for its API users. An API approach is an architectural approach that revolves around providing a program interface to a set of services to different applications serving different types of consumers.

Real-life API example.

We know the process of searching train online. Just like the restaurant, you have a variety of options to choose from, including different cities, departure and return dates, and more. Imagine that we’re booking train on railway website. we choose a departure city and date, a return city and date, class, as well as other variables. In order to book train, we interact with the railway’s website to access their database and see if any seats are available on those dates and what the costs might be.

If you are not using the railway’s website––a channel that has direct access to the information? What if we are using an online travel service, such as makemytrip or yatra, which aggregates information from a number railway databases?

The travel service, in this case, interacts with the railway’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 railway’s database to book seats. The API then takes the railway’s response to our request and delivers it right back to the online travel service, which then shows us the most updated, relevant information.

Other examples -

  1. Log-in Using XYZ

  2. Weather Snippets

  3. Log-in Using XYZ

  4. Pay with PayPal

  5. Twitter Bots

API Provides Layer of Security

Your phone’s data is never fully exposed to the server, and likewise the server is never fully exposed to your phone. Instead, each communicates with small packets of data, sharing only that which is necessary—like ordering takeout. You tell the restaurant what you would like to eat, they tell you what they need in return and then, in the end, you get your meal.

Modern API

  • API is rapidly prototyped following AGILE methodology.

  • API follows the RESTful architecture.

  • API is designed first using an API specification for rapid feedback.

  • API has a mechanism to accept feedback and suggestions for improvement.

To learn more about APIs and how to design a great API, download free eBooks

77 views0 comments