What is an API and how does it work?

I was acquainting with pulgin. Yesterday, I came to know about API; I hope most of you may know about API. Honestly, I did not know. As I am working on my dictionary website: English to Punjabi dictionary; so at a juncture of promotion of website, I was in requirement to add something to improve presence of my website on internet. So my brother (who is web developer) introduced me about API. I started to think about it how it is. I think that it is like a script to add in website..blah blah…Let’s know what is API and how to add API to website. First of all, we need to know about the meaning of API.

What is an API?

API means Application Programming Interface.  The part “interface” is prominent in it because an API communicates with program for you.  You have to know the language to talk with the program, but in absence of an API, you can’t get. API allows two applications to talk with each other.

In easy words, an API is the messenger that sends your request to the provider that you’re again requesting it from and then returns the response/result back to you.

API (messenger)->-<Provider

While writing a program, a developer does not start from beginning. APIs has enabled developers to reuse repetitive complicated processes with small coding. It is related with programming. Developers (Programmer) are now more high-yielding than they were before; they had to create a lot of codes.

When a programmer (developer) wants to present data to public, he put endpoints; he publishes a fragment of language that has been used to make a program. Other developers/programmer may take data from the application by creating URLs or using HTTP clients to request data from those endpoints.

With an API they don’t have to rewrite whole program each time; they only write a new program. Instead, they can focus on the new and unique portion of their applications and outsource all of the data functionality to APIs.

Endpoints return text to computers to read, so it will not make proper meaning if you can’t understand computer programming used to create it.

An API permits one program to request data from another. There are 15,000 publicly available APIs.

 

Why API is used?

Computer has made heavy data sorting and collection jobs easier. You got relief from repetitive jobs like adding entries and invoice making.

For example, if you are operating a milk company. A milkman supplies milk daily to you. If you want to check record of quantity; you need to check record his individual record by search company data.

On the other hand, if all reports of milk were uploaded to a central database, you could write a simple program that accesses that database and finds all the instances of the milkmen’s name. This would take much less time and be much more accurate.

There are three components of APIs:

User->Client->Server

User request->Computer accept request to send to server-> Server responds to a request

A programmer first creates server that receives and holds data. After running the server, programmer publishes documentation with endpoints. Outside programmer can easily know about structure of data through documentation. Outer user may query the data on server or can develop a program to run searches on database.

Let’s understand working of API with a simple example

Suppose there is a waiter in a hotel. As a customer, you are watching menu to choose items. Hotel cooking zone is a provider to supply your order/demand. As a customer, you require a link to talk your order to provider hotel cooking zone and then deliver your food to your table.

Waiter works as an API who works correct then your order will be successful. Like a messanger, API that takes order (means waiter in this example) and tells hotel cooking zone (server) what need to do and respond back to your request (waiter comes back with ordered food).

Same happens in signup process of social media sites. All the information and data provided for Facebook sign up is done through API. API has simplified the works.

Most of API’s are free to use but some are paid too.

Do you know that you use API in your routine activities while booking hotels, airlines, train tickets, fair tickets etc. The question is how?

Whenever you book a hotel; you visit different website like MakeMyTrip, Yatra, OYO etc. You hardly visit to a specific hotel website, because you know these websites provides better prices and discounts. You are given different hotel booking services through single website. How? It is with use of API. API controls your query and returns with proper results. API has made working and life easier.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.