DEV Community

Cover image for What is an API?
Rajan Arora
Rajan Arora

Posted on • Originally published at codemechanic.in

What is an API?

“API” stands for Application Programming Interface.

Does this definition or acronym of API help you to understand the meaning and usability of API?

Probably not.

So let’s talk about what it really means

“It’s a way for applications to talk to each other in a standardized manner.“

That’s it. That’s what API is

An API is a way for applicants to talk with each other

Now after reading this you may want some more explanation to understand the concept of API.

Let me explain through an example

For example,

If you are going to create a desktop application using WPF, the actual part of WPF is to create the user interface, which is what you use to create an interface for the application.

So you open a desktop application and enter information in the textboxes and hit buttons and so on, which is called a Graphical User Interface (GUI). Now that we talk to people, most people use GUIs for most parts, so if you have a website, it’s a GUI, you have a Graphical User Interface that you can look at graphically and interface with it. Meaning you can put information and hit buttons and can see things on the screen.

But APIs are a bit different. They are still user interfaces (you might be confused about this). Notice that an API is an Application Programming Interface. It’s an interface. So one might argue that computers aren’t users; well, they are.

Because What is a User? You can’t define a user as a person only, but actually, a user is someone who uses the application. In this case, applications are using other applications. So an API is a way for applications to talk to each other, so work is done in a standardized set of interfaces that another application can talk to.

Think of it like a class library. In a class library, we have a bunch of classes and methods.

Well, in the same way, an API has classes and methods that you can talk to. You can talk with the API and say “I want information from a specific method” and you will get it. If you want to put the information in or delete the information by using a specific method, you can do it, and it will do the job.

That’s what API is.

If you have Comment or Suggestion please let me know in the comment section or mail me @ icodemechanic@gmail.com

Top comments (2)

Collapse
 
nicoalani profile image
Nico Alani -✨🛸☄️

Good article for beginners! 👏
Also, i good way to picture the functioning of an API, is thinking about a "Restaurant"

  • The kitchen is the DB
  • The customer is the User (or the someone that uses the application)
  • The API, is the waiter

The API exist, so you can have and easy and controlled way to access the DB (or kitchen in this case), because the direct connection with the user and the database (Customer to the Kitchen) is a totally bad idea 💀

So, the API, contains all the things that you can ask to the database (as a waiter, that's like a menu) so you cannot order things that the DB cannot handle or is forbidden.

I learn this concept while i was trying to teach basis of CS in one bootcamp, and it worked

Cheers! ✨

Collapse
 
icodemechanic profile image
Rajan Arora

Thanks for sharing this awesome analogy! It’s a perfect way to simplify the concept of APIs for beginners.