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.
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.
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.
Here is the Workflow of What’s happening here.
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.
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…