Weather Forecast
This API provides real-time atmospheric data and forecasts. It resolves city names and returns temperatures (C/F), humidity, wind speed, and weather conditions.
Endpoint
Section titled “Endpoint” POST
/api/v1/weather Request Parameters
Section titled “Request Parameters”The following parameters are accepted in the request body:
| Field | Type | Required | Description |
|---|---|---|---|
city | string | Yes | The city name (e.g., “Paris”, “New York”, “Lagos”). |
Request Examples
Section titled “Request Examples”curl -X POST https://heavstal.com.ng/api/v1/weather \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-d '{"city": "Lekki"}'const response = await fetch('https://heavstal.com.ng/api/v1/weather', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': '<YOUR_API_KEY>' }, body: JSON.stringify({ city: 'Lekki' })});
const res = await response.json();console.log(`Temp: ${res.data.temp_c}°C | Condition: ${res.data.condition}`);import { search } from '@heavstal/api';
const weather = await search.weather("London");console.log(`Temp: ${weather.data.temp_c}°C | Condition: ${weather.data.condition}`);import requests
url = "https://heavstal.com.ng/api/v1/weather"headers = { "Content-Type": "application/json", "x-api-key": "<YOUR_API_KEY>"}payload = { "city": "Lekki"}
response = requests.post(url, headers=headers, json=payload)print(response.json()["data"])Response Examples
Section titled “Response Examples”{ "status": "success", "creator": "HEAVSTAL TECH", "data": { "location": "Lekki, Lagos, Nigeria", "temp_c": "28", "temp_f": "82", "condition": "Partly cloudy", "humidity": "75%", "wind": "15 km/h" }}{ "status": "error", "error": "City not found. Please verify the location name."}