# 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.

* **HTTP Method:** `GET`
    
* **Base Endpoint:**  
    [`https://api.openweathermap.org/data/2.5/weather`](https://api.openweathermap.org/data/2.5/weather)
    
* **Purpose:** To retrieve the current weather for a specified city.
    

---

### Required Parameters

| **Parameter** | **Description** |
| --- | --- |
| q | The name of the city (e.g., Lagos) |
| appid | Your 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](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

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

You can test this using tools like [Postman](https://www.postman.com/)

---

### Sample Response

```json

"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

| Field | Meaning |
| --- | --- |
| `main` | General weather condition (e.g., "Clear") |
| `description` | Detailed weather description |
| `temp` | Temperature in Kelvin |
| `feels_like` | What the temperature feels like |
| `temp_min`/`temp_max` | Daily 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.
