What is an API? | (API) Application Program Interface Definition
What is an API?
By
-
October 28, 2020
Have you ever heard the word “API,” and wondered exactly what it is? Do you have a vague idea of what you might do with an API?
API stands for Application Programming Interface. In basic terms, APIs are a set of functions and procedures that allow for the creation of applications that access data and features of other applications, services, or operating systems.
Good APIs make it easier to develop a computer program by providing all the building blocks, which are then put together by the programmer.”
What is an API?
Let’s get down to it go deeper and pick apart what an API is, what makes it different, why is it so popular, and what are the different challenges?
The API is not the database or even the server; it’s the code that governs the access point(s) for the server.
A real-world example
A real-world example is buying movie tickets online. You go to the movie site; you enter your movie, name, and credit card information, and lo-and-behold, you print out your tickets.
But what’s going on between entering your information to receiving your ticket? APIs, that’s what! They are collaborating behind the scenes with other applications.
How is this possible you ask? This type of integration is called “seamless” because you never have a clue when a software role is passed from one application to another.
Why do we need an API?
Imagine the following scenario: You (as in, your application, or your client, say a web browser or mobile app) want to access another app’s data or functionality.
For example, perhaps you want to access all Twitter tweets that mention the #jimmychoo hashtag.
You could email Twitter and ask for a spreadsheet of all these tweets. But then you’d have to find a way to import that spreadsheet into your application.
Even if you stored them in a database, as we have been, the data would become outdated very quickly. It would be impossible to keep it up to date.
It would be better and simpler for Twitter to just provide you a way to query their application to get that data so that you can view or use it in your application. It would stay up to date automatically that way.
So, the API provides access to data, so this data can be included in different applications.
History of APIs: SOAP XML V/S REST JSON APIs
In 2000, Roy Fielding’s started what we know as modern web APIs thanks to his dissertation “Architectural Styles and the Design of Network-based Software Architectures,” other forms came later.
All of this is not new. During the 2000s, we had SOAP Services which were leveraged for some of the same use cases.
REST provides a lighter-weight alternative. Many developers found SOAP cumbersome and hard to use. REST is easy to understand, and it’s simple to write and document.
This ease of use also makes it easy for other developers to understand and write applications.
REST also makes efficient use of bandwidth, as it’s much less verbose than SOAP.
REST supports many data formats, but the predominant use of JSON means better support for browser clients.
JSON sets a standardized method for consuming API payloads so that you can take advantage of its connection to JavaScript and the browser. So, what is JSON and why do we use it?
JSON stands for JavaScript Object Notation and is a way of representing data that looks like JavaScript objects.
Let’s look at a very typical JavaScript Object for a Restaurant on Yelp, which might look a bit like this:
Neat. This is fairly easy to read — our data is stored as key/value pairs.
This means that we can see the key on the left, and the value on the right. The key stays the same for each Restaurant object, but the value would be different.
A different Restaurant would have a different address, but its properties would be the same — it would always have a name, address, zip, phone, and email.
So JSON is everywhere in the modern web, mobile, and IoT applications. It’s readable, it’s lightweight, and it works super well with applications written in JavaScript, as it is JavaScript.
But is also comparatively easy to get applications written in other languages to read it and generate it as well — including Java.
This means that an API that returns JSON can be accessed by an application written in Java, Ruby, Python, JS, PHP, and many more.
This makes an API developer-friendly, highly scalable, and platform-independent.
Aha! Scalable! Platform Independent! Good words, powerful words, $$ words.
What happens in an Internet Minute?
So, with developer buy-in, APIs started exploding in importance and organizations started leveraging them with great success.
So much so that APIs became a strategic necessity for businesses.
Here’s an example of what happens in an internet minute. All these companies leverage APIs for their interactions. Who Creates these Web, Mobile, IoT-Based Public APIs?
Since this also came along with Web, Mobile, and IoT Innovations.
Especially with Public APIs. Large tech companies, especially social media companies, frequently make their aggregate data available to the public.
Not just modern or social media companies…
APIs are also maintained by government organizations, banks, healthcare organizations, conferences, publishing houses, software startups, fan groups, eSports leagues, and even individuals, to share anything from social media content to trivia questions, rankings, maps, song lyrics, recipes, parts lists, and more.
APIs are everywhere!
APIs have grown enormously popular in recent years with different types of APIs. As I mentioned earlier, this is due to a couple of key changes in the industry.
- First, the enormous growth of mobile apps that frequently talk to back ends over the web.
- Second, the rapidly emerging “Internet of Things” (IoT) promises to bring connectivity to common devices we use in our everyday lives.
Types of APIs
There are four main APIs that are often used (of course there are more):
- Open APIs which are publicly available for everyone to utilize.
- Partner APIs are custom designed by enterprises to offer access to business partners to reserve or buy specific items, such as tickets or vouchers.
- Private APIs (or Internal) are not for public consumption but are used internally.
- Composite APIs: This combines diverse data and service APIs. Its foremost abilities speed up the course of implementation, as well as advance the functioning of viewers within the web borders.
Key takeaways
It’s important to remember key takeaways for APIs are as follows:
- APIs are prevailing tools that are used to fast-track your business.
- APIs make connections and product shopping possible at a rapid speed such as booking a hotel or ordering a movie ticket.
- APIs provide key insights into real-time possibilities for analytics delivery on the spot.
- APIs give the developer the ability to make an API call or “request” to obtain information.