API what is it

Let’s talk about web API’s. What are they exactly?

Nowadays, API’s are commonly used by software developers. In this blog, we will dive deeper into the different types of API’s, the most important advantages and how Exatom uses them in their business.

An API, also known as Application Program Interface, is a set of tools and protocols for building software applications. In other words: an API outlines how multiple pieces of software components communicate with each other. It’s a guideline for the communication process between two or more entities, whichever programming language they use.

APIs have gained popularity in the last decade because they allowed businesses to open up their data, functionality, and services to external vendors or even make them publicly available. Today, the creation or usage of APIs is a commodity; almost all popular web applications like LinkedIn, Twitter and DuckDuckGo would not exist without them.

Different types of APIs

In the early days of the internet, most pages were static. With its increasing popularity, there was a need for more dynamic website functions like an account portal, the ability for online payments and more. Since 2010, the interest in using APIs has gained popularity as it allowed developers and marketers to create online user experiences that already existed offline.

Since then, we have seen a wide range of technical designs and implementations that contributed to the APIs as we know them today. Let's dive deeper into the three most popular types of APIs and how they differ from each other.

REST

Today’s most popular APIs are RESTful APIs. Compared to other types, this one is easier to use, more flexible and has an extensive toolchain and community. The RESTful API is so popular nowadays because of its request and response (input and output) format. Almost all REStful APIs use JSON notation for their requests and responses, those are easy to read and construct in textual format. The format is not limited to JSON only. Also XML, YAML and other types that satisfy the architecture needs can be formatted.

Example given:

This is a JSON example to create an account for Tim

POST /account { "name": "Tim B. Lee", "email": "tim.bl@example.io" }

As you can see, this type of API is very straightforward to read. Moreover, all modern programming and scripting languages widely support the JSON format, making it a breeze to create or consume restful APIs.

GraphQL

In 2016, GraphQL formed after the rise of restful APIs due to the need of customizing output through a uniform Query Language. Due to its strong type and relationship system, GraphQL makes it easy to only receive the data which is needed. Looking at the JSON example given earlier, this API makes it possible to filter all products Tim has ordered last year, without receiving other account information. Compared to other types of APIs, GraphQL is more complex, but can deliver the exact needed data without under or over fetching data.

Example given:

A GraphQL example for retrieving all Tim's orders

{ account(id: ) { orders (after: "2021-01-01") { edges { node { product { name, price, image, url } }, cursor } } } }
SOAP

The Simple Object Access Protocol, also known as SOAP, can be seen as the predecessor of REST. Its fundamentals lie primarily in the development of private enterprise APIs, as SOAP provides rigid language constructs to make sure that the input data is correct, according to the API’s specifications. In addition to that, SOAP also offers out of the box error-handling, retry, security and encryption capabilities.

Nowadays, SOAP APIs are still used, but because of their complex setup and the fact that they only allow XML as its less readable communication format, using SOAP never gained such popularity in web application development as REST and GraphQL did.

Example given:

A SOAP example to create an account for Tim

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Body> <CreateAccountRequest xmlns="urn:Account" email="tim.bl@example.io"> <a n="Name">Tim B. Lee</a> </CreateAccountRequest> </soap:Body> </soap:Envelope>

When comparing different types of APIs, their formats and the functionalities they offer, each API offers benefits over another. It really depends on the needs of the API you need to build. It’s not uncommon for a company to develop its primary services in REST and offer a few services based on GraphQL.

For what can APIs be used?

There are many advantages to creating an API. Think about the separation of concerns, splitting up a large piece of business logic into smaller pieces, making internal services available to the public, so on and so for forth.

For example, at Exatom we use an API between our user interface and our back-end database, where we store all forms and insights. The API abstracts the concerns and functionality of storing data, and how all the insights can be visualized in our user interface. Both services can change independently, but the API connects them and makes it possible to communicate and get things done.

That same API is used by our user interface and other Exatom applications, allowing us to connect services and events like account creation to other actions to complete the setup.

How does Exatom use APIs for their software?

There are many pieces that are API driven at Exatom. From account creation, generating the tags for your website, anonymously receiving the form analytics data and visualizing the data in our UI, it’s all API driven!

As we already had our REST API available, creating our Google Data Studio integration was a breeze. As it’s the most popular type of API, all the main components were one-on-one compatible: authentication and security, data-transfer protocol, in- and output formats, et cetera.

Advantages of API

Data is readily available, and new services and applications are all created using APIs. We live in an ecosystem with an API for almost everything, from weather services to science and even APIs that help us gain insights on Covid-19.

The advantage of living within an API driven era is that we now have platforms that can connect them or can be used to create your API. RapidAPI, Make, Zapier and others are all great resources to explore and learn more about APIs.

Whilst it does take a bit more planning and development, having an API nowadays provides more benefits than drawbacks, certainly when you want others to use it. In 2010, Apple trademarked the phrase ‘There is an app for that’. Today we can probably reword that to ‘There is an API for that’.

Do you want to know more about how we use APIs to make the best analysis of your forms? Send us a message. We love to connect with you!

Team Exatom