What exactly is an API - Explained in simple terms

What exactly is an API - Explained in simple terms

Before you begin..

Take this short Quiz on APIs to know where you stand.

Take Quiz

Come back to the quiz after reading this article and see how your score improved.

As the world is moving towards distributed systems, and also with the rise of ubiquitous networking, there is a need for sharing data, resources or even softwares across different applications, without compromising privacy and also maintaining a layer of abstraction which makes them universally understandable and easy to use, which is exactly what an API provides us. Well, that was a lot of tech jargon! Let's try to understand. Here's what you'll learn:

  1. What is an API?
  2. How does an API work?
  3. Types of Web APIs
  4. Types of Web API Architectures and Protocols
  5. Need and Uses of API in the real world

Blog Bonus: 4 Fun Activities to get hands-on with APIs - Download Resource

What is an API?

If one were to google 'What is an API?', you'll most probably get something of the sort:

"API stands for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other."

It is actually as simple as that.

API acts as an intermediary (Source: https://www.ceralytics.com/)

How well do you know your APIs? Take the quiz to find out!

Start Quiz

An API is a software which can be used by other softwares, to communicate with other softwares or even hardwares. It acts as a bridge between different softwares and devices.

API acting as a bridge across softwares and hardware devices (Source : https://apifriends.com/)

There are so many applications using different technologies and programming languages, which use APIs to interact with each other.

For example, in a Web application there is usually a Front End and a Back End, both of which can be developed using different languages like JavaScript for the frontend or Python for the backend. APIs are developed to help these two communicate and work in conjunction.

Don’t miss!

Fresh and Trendy Javascript Projects for Beginners
7 Cool and Free Javascript Project Ideas to get hands-on with React JS, Web Development, jQuery, Node JS, and more

How does an API work?

Attend the upcoming free week of learning and experience Crio for yourself.

Get hands-on with Developer Essentials: REST, HTTP, Linux, and AWS Deployment.

Enroll Now!

Say, If you were to build a software application for banking and your friend has already deployed a calculator application for calculating simple interest and compound interest, you probably wouldn't write the whole code from scratch, you would re-use the pre-existing external software components so as to prevent re-inventing the wheel and make your life as a developer easier.

But what if your friend is not willing to share his application's source code with you, as he doesn't want to compromise the security of his code or what if your friend's app uses some technology which you are not familiar with, how would you be able to use it in your own application?

The solution is for your friend to make an Application Programming Interface or an API and give its endpoint to you. Using this endpoint you can make API calls, which would help the two applications in communicating easily.

What is an endpoint?

An endpoint is a simple URL through which you can use an API (or a Web API).

For example:

Your friend may create the following endpoints for you to use:



You would have to use HTTP methods like GET, POST, PUT, DELETE, etc to make use of the endpoint.

Check out the Web Developer Essentials Track to Master REST and HTTP in just 7 days.

This way, your friend's source code remains private, and you can also make use of it in your own app regardless of the technologies used in both the softwares.

This also provides a layer of abstraction to the user of the API, as the user doesn't need to know the internal implementation of the code.


Let's take the example of an elevator for this.

Think of an elevator as a software component for a while. Its API would include information about what it can do, like go up, go down, open the doors, etc. It would also include information or an API Documentation about how you could make it do those things. For instance, if you're on the ground floor and want to go up to the fourth floor, you would just push the button for the fourth floor.

The API provides a layer of abstraction and doesn’t have to explain what happens in the internals of an elevator. That’s why, if you know how to operate a geared elevator, you can easily operate a hydraulic elevator without having to learn a whole new set of skills, and I'm quite sure you wouldn't even know the difference between the two.

(Source: https://giphy.com/)

High Level Programming languages also have APIs which provide abstraction, like Collections in Java and STL in C++, because of which the developer doesn't need to implement some of the basic components like Lists, Linked Lists, HashMaps etc. from scratch and they are also easy to use and manipulate.

Gain confidence in essential Data Structures and Algorithms concepts from an interview perspective. Linked Lists, Arrays, Stacks, Queues, more.

Another technical example could be the sorting function in JavaScript. You just need to call sort() on the array you want to sort. You don't need to know the internal implementation or the algorithm it uses, since Mozilla (Spider Monkey JS engine) uses mergeSort, while WebKit (Chrome, Safari, etc) browsers do not directly use a sorting algorithm, instead they choose the algorithm based on element types and length of the array, like numeric arrays use C++ Std library's quick sort function, Non-numeric arrays use merge sort and in some other cases it uses selection sort.

10 Best Sorting Algorithms You Must Know About
What is the fastest sorting algorithm? Which one is the simplest sorting algorithm? Why do we even use sorting algorithms? Get all your answers.

Privacy and Authentication

Now, there is another security problem. Anyone on the internet with the API endpoint can access your friend's application. This can be problematic if you are sending some data and resources which are private or only authorized personnel can view or use, or if there are some high number of computations taking place in your application to produce the results, you would naturally want to reduce the number of hits on your API, to limit the system usage. This requirement is fulfilled by integrating an authentication mechanism, such as adding a secret key or a token.

Understand What Happens When You Click The Login Button
Find out what is jwt authentication, how does it work with simple examples.

What happens in this is, the users of the API need to register themselves on the owner's platform (generally for a developer account), after which they'll be provided with a secret key, which the user would have to send every time they're making a request at the endpoint. This reduces the number of unauthorized requests and also helps the owner of the API to know who all are using their services, and this model can also be used to create paid or subscription-based plans to monetize the APIs. A good example would be Twitter's API, which has free and premium plans based on how many requests the users can make.

Twitter API pricing plan (Source: https://twitter.com/)

Generally, API gateways, which are a part of API management tools, are used to intercept all incoming requests, and manage all the authentication, rate limiting, billing and analytics. API gateways provide a single point of entry to your applications, which bundle or encapsulate the internal software architecture and also help in providing APIs tailored to different clients.

Types of Web APIs

Web APIs are APIs that can be accessed using the HTTP protocol. It can be categorized on the basis of who all can view and use it as follows:

  • Open/Public APIs: These are available to the developers or the external users with minimal restrictions. Example is Twitter API.
  • Internal APIs: These are used within an organization to exchange data and resources, and are hidden from any external user.
  • Partner APIs: These are similar to Public APIs, but these feature restricted access, meant for business partners. These are very common in Software as a service (SaaS) ecosystems. Example is the Shopify API which enables their partners to access the data present in their partner dashboard, programmatically.

How is Google Maps able to show Ola cab prices?

Take the Quiz to find out!

Go To Quiz

Learn the real-world applications of REST API, HTTP, Linux, AWS Deployment. Attend the coming free learning week at Crio.

Enroll Now

Types of Web API Architectures and Protocols

Different use cases call for different implementations and architectures. This also means different accepted data types and commands. Following are some of the most used architectures and protocols to construct an API:

  • REST (Representational State Transfer): is a sought after web API architecture. To be a REST API, an API must adhere to certain architectural constraints, like Client-Server Architecture, Statelessness, Cacheability, Layered System, etc. These are primarily used to access and work with data, and require minimum bandwidth. It supports multiple formats such as JSON, XML, HTML, YAML and plain text.

Also read: Top 10 HTML Projects for Beginners and Advanced developers

  • SOAP (simple object access protocol): is a well established web API protocol, which uses XML as the message format to transfer data. Its main function is to define the structure of the messages and methods of communication. These are driven by functionality rather than data and require more bandwidth than REST architecture. It supports only one message format - XML.
  • JSON and XML RPC: An RPC is a remote procedural call protocol. They are the simplest and oldest types of APIs. The RPC was developed for the client to execute code on a server. JSON-RPC used JSON to encode its calls, while XML-RPC used XML for the encoding.
What is JSON - The Only Guide You Need To Understand JSON
What is JSON? Where and how is JSON used? JSON vs XML Learn about JSON format and more.

Most of the software industry uses REST APIs, then comes SOAP, whereas RPC is used very rarely.

Need and Uses of API in the real world

As we have already discussed earlier, APIs make software development easier and faster. The complexity in including or building on new features is reduced because of the abstraction that an API provides, and also the data and resources can be used easily across applications.

Smart Devices and Automation

Nowadays, a lot of smart hardware devices or IoT (Internet of Things) devices are coming into the market to automate or give useful insights to the user, like Amazon's Alexa enabled devices and speakers or even fitness bands like FitBit. These devices also use APIs to communicate and interact with their servers where they can store the data and process it to build wonderful insights.

Fim de tarde
Smart Device (Photo by Alexander Ruiz / Unsplash)

Create New Services and Applications

Several companies like Spotify and Twitter provide their APIs to developers, which can be used to create different applications, like Obscurify.com which uses Spotify API to view the usage data and compare it with different users to determine how obscure your music taste is in a particular region.

You might have also seen how you can Sign Up on different sites using Google or Facebook, this is also possible because of APIs!

Sign in via Third Party Applications (Source: https://spotify.com/)

Check out the Web Developer Essentials Track to Master REST and HTTP in just 7 days.

Communication in Distributed Systems

As the applications keep getting bigger in terms of both the number of users and the code complexity, different approaches are taken to scale up the applications, like creating a distributed system, which is a system having it's different components located or "distributed" on different machines, which can communicate and coordinate with each other, while giving the illusion of appearing as a single coherent system to the end-user. For communication between these distributed systems, APIs are used.

Distributed Computing (Source: https://www.sciencedirect.com/)

In a client-server architecture, the server handles the business logic by interacting with the databases and processing the data, whereas the client handles how to visually represent that data. APIs are used to bridge the communication gap between these two. The backend developers develop the API on the server side and send its API documentation with it's endpoint to the frontend developers, who can use it on the client side to visualise the data.

Another architecture used is the microservices architecture, where a microservice is a small, single service offered by a company, where like distributed computing, the service is distributed or broken down into smaller services to make it easier to manage and scale. Microservices rely on APIs for communication, as it lets one service interact with another.

Business Growth and Collaboration

For a business to expand, having an API is a must, as this opens up new horizons for the company, like having third party integrations, where they can share their data and resources through APIs to collaborate with other businesses and developers to build new features and services.

Businesses can also integrate analytics into their APIs, to view how and who all are using their data, to get better insights, and also monetize their APIs to add another source of income.

GME Stock Chart on Robinhood App! | Via techdaily.ca | #stocks #finance #investing #gme #stonks #citadel
Photo by Tech Daily / Unsplash


As we have seen, APIs are an integral part of software development, which makes the whole process more understandable, less complex and more efficient. It also helps developers and businesses to collaborate with each other to build some exciting services.

I hope that the introduction of this article doesn't sound all gibberish now, and it does make some sense to you!

Don’t miss out

Free List of 20+ Unique Web Development Projects to add to your resume.

What you’ll find inside:

Projects in Python, Java, and Machine Learning. Learn skills like

  2. HTTP
  3. Selenium
  4. Spring
  5. Bot building
  6. Jackson
  7. Serialization-Deserialization
  8. Firebase
  9. Android basics
  10. Game Development

And more...

Build your favorite projects by following the step-by-step instructions.

Download Projects

Before you go..

Don’t miss to check out the Web Developer Essentials Track. It’s fully online and free for developers looking to grow their skills and career in software development.

Fellowship program in Software Development
Land an assured job in a top tech company. Learn Full Stack Development or Backend Development by building professional work-like projects. Enroll and start for free.

How did you score in the API quiz? Let us know in the comments.

IF you haven't taken the quiz yet, what are you waiting for? Make sure you stay ahead in the game!

Start Quiz

You've successfully subscribed to Crio Blog
Great! Next, complete checkout to get full access to all premium content.
Welcome back! You've successfully signed in.
Unable to sign you in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Billing info update failed.