Getting started with Terminologies of APIs - Beginner's guide

Ever wondered how clicking a button in an app or web page generates an OTP that's sent to your phone number? Or how do companies send promotional Whatsapp messages to customers?

Well, the simple answer is by using an API

API is everywhere be it sharing flight information between airlines and travel sites or using Google Maps in a rideshare app, unknowingly we use and interact with APIs daily.

So, what exactly is an API?

It's an Application Programming Interface....umm...is the full form clear and understandable???..nope it's not...so let's take a simple example-

You are sitting on your couch, watching your favorite TV show, and you feel like increasing the volume. You take the remote lying next to you and press the volume up button and magically the volume increases on the TV set. You had your work done by using the tv remote without actually getting up and manually increasing the volume on the tv set. Here, you were not concerned that how the remote is doing the work, but more interested in what is being done.

image.png

Here the remote acts as the interface which is used to perform some tasks in the application (TV).

Now let's move to the technical aspect-

An API or application programmable interface is a software contract that defines the expectations and interactions of a piece of code exposed to external users. This includes the parameters, response, errors, and API name. It is concerned with WHAT is being done rather than HOW it is being done.

Most of the remote APIs are built in the REST Architecture (Representational State Transfer) and are most widely followed while developing APIs.

In order to understand Remote APIs, we need to understand how to web works-

image.png

This is a typical example of client-server architecture in which client is a web browser where we enter a specific URL(Universal Resource Locator)

URL consists of HTTP(Hyper Text Transfer Protocol)

image.png

The browser sends an HTTP request to the server

image.png

The server then sends a response which consists of an HTML body

image.png

You would have noticed that while sending the request we specify the type of operation( eg-> GET). These are known as HTTP verb-

image.png

Generally, the response from the server is JSON which consists of the data requested through the API.

Important note- HTTP request is Stateless which means the server won't remember anything about the particular client.

If you want to maintain State, like remembering your login details, we need to specify with each request using headers.

Since we know that API is used to request some resources from the server, there should be a way to know whether the server has successfully returned the requested resource or not.

We get to know it by seeing the HTTP Status Code which is returned as a response. Learn about it from here

For Detailed course visit

More on API Design