What is an API?

Spread the love

Hey guys, Do you want to learn what is an API ? and The usability of an API. You are at the right place. In simple terms, API is a communicator between 1 or more applications. (One or more computers).

API stands For Application Programming Interface.That means an Interface between set of programmes,Set of computers to Share the data throught a Protocol such as HTTP.

what is an api?
what is an api?

IS API a Software?

Ah, yes kind of. An API can be software or hardware to communicate with other software or hardware. For example, a Camera API of an android device can be used to deliver Picture data to the Camera application. Google Maps API can be used to Transfer MAP data to any other device.

For example, let’s take this site. findmyfare.com Airlines. This site has most of The Airlines data of Each country. You can get the details of your Airline Service, what are the features, What are the prices, Facilities, Destinations, etc.

what is an api? Example for an api

So what you think? Is findmyfare.com directly access Sri Lankan Airlines Database to Fetch that Airline data? Think….. Well noo .that’s not like that. Instead Sri Lanka Airlines provides an API (Application Programming Interface ) to deliver Airline Information with findmyfare.com.And then findmyfare web developers Consumes that Informations received by Sri Lankan Airlines and Display on their website.

HOW API WORKS?

Let’s say you are using an API in your application. Obviously you are using at least one API with every Software that you dealing with. So you know how API is working?

Let’s say you have a Website and you want to display Latest News Details Details inside your application. What you do next? First, you have to get that API endpoint URL from Any kind of News API provider. Here I’m using this free service https://newsapi.org/.They are providing Latest News of any field like Crypto, Tech, Gaming, Fashion, Political.

First, you have to Sign up For free account using this URL https://newsapi.org/register and get an API key.

An API KEY is a uniqueue identifier for each user who is requesting The data.API key is used for Authenticating Users who is requesting data.Otherwise the api Will be Public to Every one. (There are lot’s of public API s in internet that not required to have an API key).

here is my API URL with the API key attached to it.

https://newsapi.org/v2/everything?q=bitcoin&from=2019-11-20&sortBy=publishedAt&apiKey=b16fbde0cf734b529182669f488030ea

what is an api? Example for an api?Api json response example

This will return the Latest BITCOIN information as a JSON response. Now you can use this data inside your Application to show Latest Bitcoin Information to the Users who are using your Web site.

Here is the Workflow of What’s happening here.

what is an api? Example for an api? Api Workflow,How api works

I assume that you can understand the above image. Lets little bit talk about Status Codes in Http Request/Response.

Http status code is telling you whether the Request/Response is Successful or not. See the below chart.

Http Status codes

Okay, that’s it, guys. In this simple introduction to What is an API? I talked about the term API. In the next post, we will be creating an API from the Scratch using Node Js /Laravel to understand more about API. If you have any issues or any questions regarding this “What is an API ?” please comment below. Good Day…

Hi, I'm a software engineer from Sri Lanka who has knowledge in programming languages like Dart | PHP | Javascript |C# |Java, etc. Currently studying Computer Science at University College Coventry , London.

2 thoughts on “What is an API?

Leave a Reply

Your email address will not be published. Required fields are marked *