Whether it’s a mobile application, a website, your company’s accounting software, and more recently your watch and maybe your refrigerator; they all have something in common. They connect to (consume) an API.
What’s an API?
Technically, API is an acronym for Application Programming Interface. However, for most readers, it still doesn’t make any sense! In plain English, an API is just a set of functions running on a server that any application can call to retrieve any information that the API provides. Now to be super honest here, this is a very minimalistic approach to what an API does, but this is basically it!
Most of the large companies (or companies modern enough) are leveraging APIs to develop their latest mobile applications and websites. Up until recent times, most companies connected their applications directly to the database to pull the data they needed.
Let’s take the example of an application that shows you the weather information for a city that you select. For the sake of simplicity and visualization, the mobile interface would show you a drop-down menu with 4 or 5 cities and you get to select a city and press the “Submit” button. The legacy method would have been to connect to a database using an adapter installed inside the mobile application (e.g. MySQL, etc.) fetch the information and display them on the user interface.
This works, but if there’s any logic attached to the processing of this information it will have to be done inside the mobile application itself (frontend logic). Inherently, any logic such as converting the weather information from Celsius to Fahrenheit will have to be done inside the code itself. If the app was available for both iOS and Android, it means we have to write the code to convert from Celsius to Fahrenheit inside two separate applications (most of the time also by two separate coders) to achieve the desired outcome. Of course, this was a simple example! Usually, the routines and functions necessary to provide any real value are way more complex than the context I provided, this would force redundancy on the frontend engineers working on the project. Most of the projects usually have a website (web interface) and two mobile applications, one for iOS and one for Android. That means any logic has been written three times with the nativity of each platform in mind! Huge cost and a huge obstacle for scaling!!
An API removes redundancy and puts the logic on a separate layer that falls between the database and the mobile applications (or website).
Let’s take the Celsius/Fahrenheit conversion example that we talked about, now the logic moves to a central server between the mobile application and the database, let’s call this server the API Server (Genius name!), the API Server will provide a function that we can call that will do the conversion for us! That means the frontend developer will connect to a function called /weather/city/Celsius to retrieve the Celsius weather and can connect to a function called /weather/city/Fahrenheit to retrieve the Fahrenheit value! Doing this saved us from writing the same logic 3 times on different devices to simply coding it once and fetching it from a central server.
Also, imagine that the logic needs to be changed or updated at some point, maybe we discovered a small bug in the formula that converts the Celsius to Fahrenheit, in the sad No-API world, we would have to change the code 3 times for the three environments and the update every single application on the stores. This is a lot of work for something that simple!
In the awesome API driven world, this would require us updating one line of code in the API and then publishing it, the applications are already connecting to the API and everything would be working just like that!
To conclude, the APInization of the web has begun, it might sound like a big step for most companies to make but in the scope of large web and mobile applications, it’s a crucial step! It allows the product team to craft a supreme user experience that focuses on the interactive layer, frontends are frontends after all … a gateway to a much larger value driven by a well-built API. If the API is good then scaling, coding and maintenance times are significantly slashed, allowing the owner of a platform to create and update at a faster rate.
Contact me on HERE so you’d get a free consultation on how to set up your first API.
Thank you for reading!