6 min read
🔌beginner

What Are APIs? — How Apps Talk to Each Other

Discover what APIs are, why they matter, and how they let different apps and services communicate with each other.

APIs are Everywhere

API stands for Application Programming Interface. That sounds complicated, but it is really simple: an API is a way for two programs to talk to each other. Think of a restaurant. You (the customer) do not go into the kitchen and cook your own food. Instead, you tell the waiter what you want, the waiter tells the kitchen, and the kitchen sends back your food. The waiter is like an API — a middleman that takes your request and delivers the response. When a weather app shows you the temperature, it is not measuring the weather itself. It sends a request to a weather API, which responds with the data. The app just displays it nicely.

Real APIs You Use Every Day

Almost every app you use relies on APIs: - When you log in with Google on another website, that site uses Google's authentication API - When you see a map in an app, it is probably using Google Maps API - When a website shows a payment form, it uses Stripe's payment API - When an app shows you the weather, it uses a weather API - When a site shows YouTube videos embedded, it uses YouTube's API APIs let developers build on top of each other's work instead of reinventing the wheel. Why build a maps system from scratch when you can use one that already exists?

How APIs Work

Most web APIs work with simple requests and responses: 1. Your app sends a REQUEST to a specific URL (called an endpoint) Example: GET https://api.weather.com/current?city=London 2. The server processes the request 3. The server sends back a RESPONSE with the data (usually in JSON format) Example: { 'temperature': 18, 'condition': 'cloudy' } The key methods (just like we learned in the internet lesson): - GET = 'Give me data' - POST = 'Save this new data' - PUT = 'Update this existing data' - DELETE = 'Remove this data'
Pro Tip

Many APIs are free to use (with limits on how many requests you can make). Some cool free APIs to play with: the Pokemon API (pokeapi.co) gives you data on every Pokemon, the Dad Jokes API gives you random jokes, and the NASA API gives you astronomy pictures and Mars rover photos!

Explore a Real API

Open your browser and type this URL: https://pokeapi.co/api/v2/pokemon/pikachu — You just made a GET request to the Pokemon API! Look at the data that comes back. Can you find Pikachu's types, abilities, and base stats in the response? Try changing 'pikachu' to other Pokemon names. This is exactly what apps do behind the scenes, but they display the data in a pretty interface instead of raw text.

Ready to build?

Put what you learned into practice — pick a project and start coding.

Start Building Free