What is an API?

If you've wondered what an API is, this thread is for you.

Here, I try to explain what an API is, using imagery, to help you get the main idea behind this common term mentioned several times amongst developers.

[A thread] 👇

#100DaysOfCode #code #coding
API, Application Programming Interface, is a computing interface that defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc.
Uhh... what?🤷‍♂️🤔

To instruct a computer, we use a means to "talk" to it, thus, by using devices like the mouse & keyboard. It'd then "respond" to us via an output device, say the screen.

These are *interfaces* that allow the communication between a user & their computer.
Before two different software can communicate with each other, there must be an interface: a machine-understandable means of sending requests & receiving responses.

APIs to the rescue! 🚀
APIs are simply intermediaries that allow software A to "talk" to software B, with their common purpose being an interface through which *data* can be sent & received between different software.
Every API has its own data that it provides, & rules that govern how the data can be interacted with.

You'd often find a documentation serving as a manual for the API: who can access it, what can be accessed, what requests can be made, what kind of response can be received, etc.
An API documentation is written for developers who'd want to use the API, so they may know what *endpoints* they can make their requests to, (a process known as an "API call"), & also, informing them what kind of data (request) can be sent to the 3rd-party software.
What's an API endpoint? 🤷‍♂️🤔

It is a point (in an API) to which another software can connect.

Every endpoint has its rules; what kind of data it provides, & what kind of requests can be made to it.

NB: Some endpoints may need authentication before its data can be accessed.
Let's take a look at an example:

You visit a restaurant & a menu, listing all kinds of meals/drinks available, is provided to you to make a choice.

You make a choice & a waiter goes somewhere (say, the kitchen) & brings what you've ordered. You consume it.
Here, you're the software that needs some data.

The menu provided to you is an API documentation telling you what meals (data) you can get at that time. By giving the waiter (API) your order, you've made an API call (a request) detailing what you want from the server. 👇
The server (kitchen), containing the business logic (cooks, cooking utensils, etc.), gets your requested data (ordered meals), gives it to the waiter & then your meal is brought back for you to eat (ie. a response is received, with the data which can be used in your software). 👇
You do not know or care how the meal (data) is prepared; all that is important is you're starving and your stomach (software) needs to be filled (populated with data).
This marks the end of the thread. More of this is coming soon.

Did I make a mistake? Kindly comment with a correction.

Leave any questions you may have & I'll try to answer them for you.

Retweet for others to benefit.
You can follow @GyenAbubakar.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.