All About APIs
API’s are all about connectivity. In our modern, online world, we have all become accustomed to the connectivity that makes anything we want available at the click of a button (or two). Whether it’s from a laptop or a phone, we can buy, post or book almost anything, from anywhere.
But what is it that enables this to happen? What is working behind the scenes to transfer data, getting it from A to B? How do different applications and devices interlink, so that we can place an order, reserve a table, or book a flight?
Living in this day and age, we don’t really think about these questions. We just expect the various composite parts of our digital world to be in sync. However, there’s a hidden hero behind it all. And it is… the Application Programming Interface, or API.
API’s work behind the scenes to make possible all the digital interactivity which has come to shape our society today. For many people, especially those who wouldn’t consider themselves tech-savvy, as soon as a three letter initialism like API comes up, they become instantly confused. What’s more, many online definitions of API’s are long-winded, over-complicated and downright baffling.
So I’ve decided to write this blog to break down the concept into digestible parts, helping you to understand what an API is, and what it does.
What is an API?
Many of those getting into tech will eventually ask the question, ‘so, what exactly is an API?’. We’ve already given a brief overview of the concept, but to really get to the root of it, let’s look at an analogy or two that have proved extremely helpful, for myself and others, in demonstrating an API’s function.
An API is like a messenger. It takes a request (or requests) from a user, and delivers it to a system, instructing the system to carry out the request. The system then returns the response back to the user. Sounds like a pretty simple interaction, right?
Let’s look at it a slightly different way. Think about going to a restaurant for a nice meal. You sit down at the table, and choose what you want to eat from the menu. In other words, you’re the user who makes a request. The kitchen of the restaurant is the element in the exchange which will cook up the order, i.e. the system that will receive the request and generate a response. But where’s the link?
This is where the waiter (the API) comes in. He is the messenger, taking your request, or order, and tells the kitchen, or system, what to do, before delivering the response back to you, which in the restaurant example, would be a delicious plate of food! Hopefully you can begin to see the role an API plays in the transfer of information on the web.
Now, let’s get a bit more technical. Say we have an application. This took years of development and millions of pounds to build. To be a worldwide success, we want the application to be able to integrate with other popular applications and services. But this creates a slight problem. Having to build custom integrations with the thousands of 3rd party apps available just would not be feasible.
This is where APIs come in. We can build an API onto our application, acting like a doorway into the app. Using the doorway, other 3rd party apps can get access to all the data and features we have built, without us needing to provide any custom code, whatsoever.
So how does it work? Let’s say a custom app wants to access some of the data or features that we have built. It sends an API request, in the form of a simple HTTP message. In this example, we are using a GET message to request information, but there are other HTTP methods available, such as:
These HTTP methods correspond with something called CRUD operations. CRUD stands for Create, Read, Update and Delete.
The POST method creates something on the web app. GET requests read information from the application. PUT updates information on the app, and so does PATCH. The difference between these two is that PUT replaces the information, while PATCH edits it. Finally, DELETE will delete the information.
After the API request has been sent out, the application will send back a response to the customer app, usually in a JSON or XML format.
Now, let’s take a look at a real-life example. The example we are going to look at is a weather app, with a huge network of weather stations all around the globe. Our custom app in the exchange is a mobile app.
For most of us, compiling and storing information on a world wide network of weather stations is pretty much impossible. But, this is the beauty of APIs. Anyone can build a mobile app, and then utilise APIs to request data from an already extant weather application.
So what would this look like? Our mobile app sends an API GET request to the weather application. An API request, would take the form of a simple URL, containing some fields. One field is where the app would enter the city, and the other field is something called an API Key. An API Key is usually required for the application to keep track of the number of requests sent, and make sure they don’t get overloaded and spammed.
Once the application receives the request, it will respond with the requested data, likely in JSON format. The data includes different values, such as the temperature, what the temperature feels like, humidity, pressure, etc.
With this data, we can program our mobile app to take the information and display it in a beautiful looking interface, complete with cool colours, fonts, and animations!
How we use APIs
Here at Step Labs, we champion Webflow and Shopify as the ideal platforms for building beautiful websites and online stores. But how do these platforms use APIs to help millions of people run their businesses? Let’s take a look.
The Webflow API, in JSON format, allows you to create, update and manage content on the Webflow CMS. It enables the connection of external data sources to Webflow sites.
Custom Webflow API integration requires application development from scratch. The service interface doesn’t support or provide tools for no/low-code API integration. Non-developers who are unwilling to invest in programming can search for third-party solutions in order to connect Webflow to an API that meets their requirements.
Shopify API Integration is the process of linking SaaS applications with the Shopify platform. Software providers who want to propose their services to online retailers using Shopify to sell products or services online.
Without reliable Shopify API integration, software providers cannot help e-commerce owners to manage and organise their online sales process.
One example might be if you run a shipping software for e-commerce, and you want to import orders from Shopify-based stores, firstly, you will need to build a connection between Shopify and your solution. Otherwise, you cannot filter orders, make shipments, and update order statuses.
Shopify API integration can bring a lot of benefits for eCommerce vendors. It allows them to propose their services to a wider audience. It also enables them to expand their market share and allows software providers to enhance the functionality of their solutions and increase their sales.
We are Step Labs - a Webflow & Shopify web design & development agency! If you would like to build a beautiful and high-performing website, contact us at email@example.com.
Written By: Matthew @ Step Labs