HDG explains: what is an API?

On an internet full of confusing and unfamiliar acronyms, it can be easy to get confused. One web acronym you may have heard but never felt to look at is “API.”

What is an API? API is an acronym for: application programming interface:and is a name for a series of routines and protocols that make the process of building software applications much easier.

An easy way to look at an API is as a roadmap that tells the components of a piece of software how to communicate. Without the use of an API, the source code could look like a jumbled, confusing mess.

However, APIs are complex and require more than a brief summary. In this article, let’s discuss how APIs work and what sites and services use them.

What is an API and how does it work?

Now that we’ve established that an API is a set of routines that point software in the right direction, how exactly does this all work?

The best way to explain the core functionality of an API is to give a real-life example. Meal delivery services, such as: GrubHubare incredibly popular right now, so let’s discuss how the code behind mobile apps like this might work.

When you search for a restaurant or dish on any of these apps, you’ll receive relevant results based on your keywords and location. After you select a result, you’ll be presented with options for food items, delivery times, and more restaurant-specific options.

To schedule your delivery, there must be a connection between the delivery website and a database – the website is the frontend and the database is the backend. The database stores the data for all these restaurants, their availability by location, operating schedule, menus and more.

The API is the connection between this database and the website or app that presents the data. It is important that an API is in place to make this connection, rather than using hard-coded data, mainly due to the popularity of third-party integrations.

For example, it would be beneficial for a website if third-party aggregators were able to list and organize all available restaurants and items, right? Without an API, this would not be possible without using inefficient web scraping techniques.

The API is the interface responsible for delivering the data from the database to the application, be it a website, mobile app or anything else. APIs have become the standard way of accessing and communicating application data over the Internet, and any major website or service that relies on third-party connectivity benefits greatly by providing one.

What types of APIs are there?

There are several different types of API protocols, but the three most popular are SOAP (Simple Object Access Protocol), REST (Representational State Transfer), and RPC (Remote Procedure Call).

SOAP APIs

SOAP was first introduced in the late 1990s and allowed applications to easily share resources over network connections. SOAP relies on standard protocols, such as HTTP and SMTP, which allows it to be used in almost any environment due to the popularity of such protocols.

Its main strength is that it is widely used and established. If it ain’t broke, don’t fix it.

REST APIs

REST was introduced in 2000 by Roy Fielding. Its immediate goal was to provide an answer to many of the problems caused by the widespread adoption of SOAP.

Similar to SOAP, REST relies on HTTP to transfer information between applications. However, one major difference that sets it apart from SOAP, which requires data to be sent via the XML data format, is that it supports JSON. JSON is a data format that many agree is easier to read and write. In addition, REST APIs can cache data, allowing for much better performance.

REST now accounts for more than 80% of all APIs, according to a 2017 report from Cloud Elements.

RPC APIs

RPC APIs come in many flavors, but as we have learned from REST APIs, JSON is a very popular data format, so JSON-RPC is the most popular.

JSON-RPC is a protocol best suited for minimalists and users who rely on the straightforwardness of their API. It is much more limited in scope compared to SOAP and REST, and it is very limited in its flexibility and set of commands, but for some developers less is more.

There are other RPC-based API types, such as gRPC, but JSON-RPC is the way to go if simplicity of implementation is your priority.

Who Uses APIs?

Developers of any kind, be it frontend or backend, should have experience working with APIs. In the field of websites or web services, almost all major players have some kind of API available, Windows being the most obvious.

Since Microsoft Windows is the most popular operating system in the world, it is only natural that application developers need a set of guidelines for interacting with the user interface. Without access to the Windows APIprogramming an application that relies heavily on interacting with the operating system would be a major headache.

There are thousands of APIs, some free and some paid. Here are just a few examples worth looking at:

  • Google Play Developer API Publishing and app management tasks related to Google Play
  • Skyscanner APIs Travel-based APIs related to flights, car rental and more
  • Twilio API Enables sending and receiving of phone calls programmatically
  • Discord API Allows users to create the bots that make Discord the messaging service it is today
  • IPinfo APIOn-the-fly IP address and geolocation data for your website or app

APIs are one of the key connectors behind some of the web’s largest and most important websites and applications. While the average user may not see the benefit of APIs, they are a godsend for developers and web services.

Leave a Reply

Your email address will not be published.