API(Application Programming Interface)
Published: 2022-08-07 18:29:00

>Connectivity is an Amazing thing by now we're all used to the instant connectivity that puts the world at our fingerprint from desktops to the mobile devices we can purchase (Online Shopping) post(Facebook ,Instagram) anything from anywhere we are connected to the world and each other like never before, but how does it happen , how does data get from here to there how do different devices and application connect with each other to allow us to place an order make a reservation or book a flight with just a few types of things the unsung hero of our connected world is the API it's the engine under the hood &  is behind the scenes that we take for granted but it's what makes possible all the interactivity we've come to expect and rely upon but exactly What's an API?

## What is an API ?
- Application programming interface
- Information/contract provided by one piece of software to another.
- Structured request and response.
- APIs are everywhere.

> To speak plainly, an API is the messenger that runs and delivers your request to the provider you’re requesting it from, and then delivers the response back to you.
 
>Let's say you want to go to the America and you prefer to go by air. So you start searching for airline flights online.
In order to book your flight, you interact with the airline’s website to access the airline’s database to see if any seats are available on those dates, and what the cost might be based on certain variables.
But, what if you are not using the airline’s website, which has direct access to the information? What if you are using online travel service that aggregates information from many different airlines? Just like a human interacts with the airline’s website do to get that information, that's API's comes into the picture.
The API is the interface that, like your helpful **travel service**, that runs and delivers the data from that online travel service to the airline’s systems over the Internet. 
And through each step of the process it facilitates that interaction between the travel service and the airline’s systems from seat selection to payment and booking. 
So now you can see that it’s APIs that make it possible for us all to use travel sites. They interface with with airlines’ APIs to gather information in order to present options back to us.
The same goes for all interactions between applications, data and devices - they all have API’s that allow computers to operate them, and that's what ultimately creates connectivity.

> API’s provide a standard way of accessing any application, data or device whether it is shopping from your phone, or accessing cloud applications at work.
So, whenever you think of an API, just think of it as your waiter running back and forth between applications, databases and devices to deliver data and create the connectivity that puts the world at our fingertips.


![API](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ir46m4ysd1cstmvd4b5.png)

## What is REST?
- Representational State Transfer or Restful Services.
- Architecture style for designing networked applications.
- Relies on a stateless,client-server protocol, almost always HTTP.
- Treats server objects as resources that can be created or destroyed.
- Can be used by virtually any programming language.

## HTTP Methods
**GET** - Retrieve data from a specified resource.
**POST** - Submit data to be processed to a specified resource.
**PUT** -  Update a specified resource.
**DELETE** - Delete a specified resource.

> **HEAD** - Same as get but does not return a body.
> **OPTIONS** - Returns the supported HTTP methods.
> **PATCH** - Update partial resources.

## Endpoints
The URI/URL where api/service can be accessed by a client application 

## Authentication 
Some API's require authentication to use their service. This could be free or paid.