Profile Image

Robert Yawa

Web Designer &Programmer

Understanding APIs: A Simple Guide

APIs let apps talk to each other. Here’s a simple, real example.

Example: Fetching Weather Data

fetch("https://api.openweathermap.org/data/2.5/weather?q=Nairobi&appid=YOUR_KEY")
  .then(res => res.json())
  .then(data => console.log(data));

Sample JSON Response:

{
  "weather": [{ "description": "clear sky" }],
  "main": { "temp": 298.15 }
}

This is how front-end apps display weather, maps, payments, etc.

Share this content