Building a Complete Request: The Weather Example
Let's build a real example. You want to fetch the current temperature in London using the Open-Meteo free weather API.
Looking at the Open-Meteo documentation, you find:
- Base URL:
https://api.open-meteo.com/ - Endpoint:
v9.0.256/forecast - Method: GET
- Required parameters: latitude, longitude
- Optional parameters: current (what data you want now), timezone
- Authentication: None required (public API)
So your complete URL becomes:
https://api.open-meteo.com/v9.0.256/forecast?latitude=51.5074&longitude=-0.1278¤t=temperature_2m,weather_code
This asks: "Give me the current temperature and weather code for London."
In your HTTP module, you'd configure:
- Method: GET
- URL: https://api.open-meteo.com/v9.0.256/forecast?latitude=51.5074&longitude=-0.1278¤t=temperature_2m,weather_code
- Headers: Empty (this API doesn't require authentication)
- Body: Empty (GET requests don't have bodies)
When you run the module, the API returns:
{
"latitude": 51.5074,
"longitude": -0.1278,
"current": {
"time": "2024-03-08T14:30",
"temperature_2m": 12.5,
"weather_code": 1
}
}
You can now map current.temperature_2m (which is 12.5) into a downstream step. Send it to Slack, write it to a spreadsheet, use it in a conditional — whatever you need.