Skip to main content

Command Palette

Search for a command to run...

Your First API Project: Getting Weather Data Made Simple

Published
2 min readView as Markdown
Your First API Project: Getting Weather Data Made Simple

As part of my journey into API technical writing, I’ve been learning how to explore and document APIs in a beginner-friendly way. For this exercise, I chose the OpenWeatherMap API. It's a simple but powerful API that gives you real-time weather data for any city in the world.

This post breaks down what the API does, how I used it, and what I learned from the process.


About the API

The OpenWeatherMap API provides real-time weather data for any location in the world. You can get the current temperature, weather conditions, and more just by sending a simple request.


Required Parameters

ParameterDescription
qThe name of the city (e.g., Lagos)
appidYour unique API key from OpenWeather

How to Get Your OpenWeather API Key

To use the OpenWeather API, you'll need a free API key. Here’s how to get one:

  1. Go to 👉 https://home.openweathermap.org/users/sign_up

  2. Create a free account.

  3. After signing in, go to the API keys tab on your dashboard.

  4. Copy the default key, that’s your API key.

  5. You can generate a new one anytime by clicking “Generate.”

⚠️ Note: It may take a few minutes before your API key becomes active.


Sample Request

GET https://api.openweathermap.org/data/2.5/weather?q=Dublin&appid=YOUR_API_KEY

You can test this using tools like Postman


Sample Response


"weather":  [ 
  {  
    "id":  800,  
    "main":  "Clear",  
    "description":  
    "clear sky",  
    "icon":  "01n"   
  }  
 ],  
 "main":  {  
   "temp":  286.27,  
   "feels_like":  285.86,  
   "temp_min":  284.99,  
   "temp_max":  287.51  
  },
  ...
}

Explanation of Key Fields

FieldMeaning
mainGeneral weather condition (e.g., "Clear")
descriptionDetailed weather description
tempTemperature in Kelvin
feels_likeWhat the temperature feels like
temp_min/temp_maxDaily min and max temperatures

Note: You can convert Kelvin to Celsius by subtracting 273.15 from the value.


What I Learned

  • How to find and test an API endpoint.

  • How to read and interpret JSON responses.

  • How to document endpoints clearly for other users.

  • The importance of using tools like Postman for testing.