I have been learning a little bit about APIs these days and I must say, I can only understand the analogy of "server-waiter/waitress" after studying for so long. It will take time but we will get there.
PS: If you do not understand what I am saying, we will get there next.
In the following blog post, we will discuss what an API is and discuss it in the context of my knowledge. We will learn together about API as I keep sharing everything I am learning!
What exactly is an API?
The full form of API is Application Programming Interface. An API helps transport functionalities or services from one product to another.
Let's look at API through an example in the following section:
Working of an API
APIs use the concept of abstraction. It is hidden from everyone (but developers) on what happens when a button is clicked, or when an interaction with an online advertisement is made. The end-user doesn't even realise the existence of some other entity that provides the support for a function to be done.
A university website has a webpage where the students who wish to get admission in the following year could check an approximate calculation for the fees that would have to be paid.
Suppose the form has the following fields: Degree, Program, Does the student want a dorm room? etc.
This webpage is where the user will interact, the user does not know what happens when they select the option.
There is a company xyz that has built a code that can be used by all the universities to calculate the total fees.
For the interaction of the university and xyz company, xyz company provides an API link which can be embedded with the form - this is called API Integration.
When a user clicks on submit button, an API call occurs.
This API call will send a signal to the API requesting the software to perform a subroutine. Here, it means bringing the code for calculation.
The calculation is made through abstract methods.
The result obtained in above step is given to the user as an answer.
It is not necessary that API would always return a piece of code. It is possible to provide/take services for images, music, video, written things etc.
The idea of APIs emerged through the works of Wilkes, Wheeler, and Gill who are considered to be the pioneers of software engineering.
Use cases of APIs
Typically, this is what an API will do for its user:
Bring needed functionalities from one software to another
APIs have become a backbone for no-code technologies found around you - for example, WordPress lets one create a website without the need for code, all through drag and drop and the press of buttons. A person who does not know need not go and read what is behind.
When you click on '
Sign-In with Google', you are using an API!
Devices that can be controlled digitally are major use cases of APIs
APIs make it easier for individuals from non-technical backgrounds to interact with various web and software applications without knowing what goes behind them.
Well, technically speaking - nobody knows what goes behind an API unless it is
Opensource of course.
Interesting! right? If you see this way, API is around us everywhere. Application Programming Interfaces might be the air of the tech world.
For using a google font in your website, you use google API:
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Sofia">
Types of APIs
There are various ways to categorize APIs. They can be diversified according to their use cases, the audience they serve the purpose for and the advantages that the API might provide.
Largely, APIs are classified as Public, Partner, Internal and Composite.
These APIs are available for developers and businesses to use for free or with minimal restrictions. Sometimes, the API provider might ask for authorization through various methods but many are available to interact with, without the need for any authorization. It is not necessary for a Public API to be open source, but rather it depends on the restrictions it adheres to for the users that can interact with the API.
✨ Public APIs is a GitHub repository which enlists all free-to-use APIs: https://github.com/public-apis/public-apis
There are categories like Anime, Books, Music etc. - This just shows how wide the scope of APIs is!
These APIs are available only to specific audiences/developers - ones that are given access by some particular method of verification. These can be free or paid but the difference is through the access given.
Some examples of Partner APIs are Amazon API, Airbnb API as well as higher versions of Twitter API.
Internal or Private APIs
As the name suggests, Internal APIs are used within an organization. These are created to bring faster functionalities within a company. They are completely hidden from the public. The advantages of these APIs are reusability and an increased working pace in the development ecosystem.
Composite APIs are as the name suggests, composed of more than one API as well as bring multiple data to be formed. Several API requests are combined into one call making.
One example of Composite API is Postman Collections.
I highly recommend checking out this beautiful graphic novel - The API-First World by Postman API which explains APIs in a beautiful way!
In conclusion, Application Programmable Interface provides an interface or an intersection for two programs or pieces of code or services to interact with each other to enhance functionalities on the client-side.
The upcoming articles in the API series will be exciting, we will discuss various protocols and architecture of APIs. It was exciting learning about APIs and I cannot wait to dive deeper into it!
The blog post has come together after research and reading from various sources. All these sources are available in a list here, feel free to browse through them for a deeper understanding of any sections in the blog.
Credits for vector used in Cover of the Blog: Image by storyset on Freepik
The article is written by
Yes, by me! Krupali on this side. I am a computer science student who enjoys talking about Opensource and currently exploring the world of web development and web3. Blogs and articles are something I enjoy writing as well as reading, it really is so much fun! Reach out if you want help with blogs, articles or anything open source.
If you liked what you read, don't forget to drop a comment :) It gives me the motivation to write more!
Did you find this article valuable?
Support Krupali Trivedi by becoming a sponsor. Any amount is appreciated!