Prompt

weather api current and forecast data

Technology / API Platforms1 observationLast seen Oct 8, 2026

Latest observation

Oct 8, 2026OpenAI APIWeb search: off

Here’s a simple way to get current weather and forecast weather data from a weather API.

Common approach

Most weather APIs provide endpoints like:

  • Current weather: current temperature, conditions, humidity, wind
  • Forecast: hourly or daily predictions

Example using OpenWeather

1) Current weather endpoint

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

2) Forecast endpoint

GET https://api.openweathermap.org/data/2.5/forecast?q=London&appid=YOUR_API_KEY&units=metric

Example response fields

Current weather

  • main.temp → temperature
  • weather[0].description → condition text
  • main.humidity → humidity
  • wind.speed → wind speed

Forecast

  • list[] → forecast entries
  • dt_txt → date/time
  • main.temp → forecast temperature
  • weather[0].description → forecast condition

Example in JavaScript

const API_KEY = "YOUR_API_KEY";
const city = "London";

async function getWeather() {
  const currentRes = await fetch(
    `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${API_KEY}&units=metric`
  );
  const currentData = await currentRes.json();

  const forecastRes = await fetch(
    `https://api.openweathermap.org/data/2.5/forecast?q=${city}&appid=${API_KEY}&units=metric`
  );
  const forecastData = await forecastRes.json();

  console.log("Current:", currentData);
  console.log("Forecast:", forecastData);
}

getWeather();

Example in Python

import requests

API_KEY = "YOUR_API_KEY"
city = "London"

current_url = f"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_KEY}&units=metric"
forecast_url = f"https://api.openweathermap.org/data/2.5/forecast?q={city}&appid={API_KEY}&units=metric"

current_data = requests.get(current_url).json()
forecast_data = requests.get(forecast_url).json()

print("Current:", current_data)
print("Forecast:", forecast_data)

Alternatives

Other popular weather APIs:

  • WeatherAPI.com
  • Tomorrow.io
  • Meteomatics
  • Open-Meteo (free, no API key for many uses)

If you want, I can also provide:

  1. a full React example,
  2. a Node.js backend example, or
  3. a free weather API option without an API key.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.