Tech

What is an API?

Published
Published:
Table of Contents

An API is a way for one program to talk to another. Instead of a human clicking buttons, a program sends a request and gets back data. Most apps you use are quietly talking to dozens of APIs behind the scenes.

The restaurant menu idea

A common way to explain it: an API is like a menu in a restaurant. The menu lists what you can order. You do not need to know how the kitchen works — you just ask for an item, and it arrives.

In the same way, a weather API lists what you can ask for (“give me today’s weather for Delhi”), and you get the answer without knowing how they measured it.

How it usually looks

Most modern APIs work over HTTP and reply with JSON. You ask for a web address, and you get back neat data:

GET https://api.example.com/weather?city=Delhi

The reply might be:

{
  "city": "Delhi",
  "temperature": 38,
  "condition": "Hot, obviously"
}

Your program reads that JSON and shows it nicely in an app.

Why APIs are everywhere

  • They let apps reuse each other’s work. A travel app does not build its own maps — it asks Google’s map API.
  • They keep things separate and tidy. The kitchen can change without changing the menu.
  • They let companies offer their data and services to other developers.

The takeaway

An API is just a polite, agreed way to ask a program for something and get a clear answer back. Once you see that, half the buzzwords in tech suddenly make sense.

Support this post Sponsor