Skip to content
DDataNest

Weather · 4 min read

How to use the Weather API in Python & JavaScript

Weather is one of the most-requested data types in apps. Here's the quickest way to get weather results without managing providers.

By DataNest · Published May 2026

What the Weather API API does

Lightweight weather data with current conditions, 7-day and hourly forecasts, historical lookups, and location search. Powered by Open-Meteo, no key juggling. Responses are JSON, the API runs behind the RapidAPI gateway for auth and rate limiting, and there's a free tier for prototyping.

When to use it

weather widgets
delivery apps
outdoor planners

The example request

GET https://weather-api-by-datanest.p.rapidapi.com/v1/weather?city=London

Example JSON response

An illustrative response body — run the live demo for the real thing.

{
  "city": "Berlin",
  "temperatureC": 14.6,
  "humidity": 71,
  "windKph": 18.2,
  "uvIndex": 3,
  "airQualityIndex": 42,
  "forecast7d": [
    {
      "day": "Mon",
      "highC": 16,
      "lowC": 9,
      "condition": "Partly cloudy"
    },
    {
      "day": "Tue",
      "highC": 18,
      "lowC": 10,
      "condition": "Sunny"
    }
  ]
}

Common parameters

ParameterInRequiredExample
cityqueryYesBerlin
x-rapidapi-keyheaderYesYOUR_RAPIDAPI_KEY
x-rapidapi-hostheaderYesweather-api-by-datanest.p.rapidapi.com

Step by step

1. Subscribe and get your key

Open the Weather API API on RapidAPI, subscribe to the free BASIC plan, and copy your X-RapidAPI-Key.

2. Call the endpoint

The example call for this API is shown above. The quick-start snippets below send exactly that request in cURL, Python and Node so you get a real response on the first try.

3. Try it without code first

The Weather API page has a live "Try it" panel — change the input, run it, and inspect the real JSON before you integrate.

4. Integrate and cache

Call it from your backend and cache responses where it makes sense. For fast-moving data, a short TTL keeps it fresh without hammering the API.

Quick-start code

curl --request GET \
  --url 'https://weather-api-by-datanest.p.rapidapi.com/v1/weather?city=Berlin' \
  --header 'x-rapidapi-host: weather-api-by-datanest.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'

What you can build

Weather widget

Drop a current-conditions card into any dashboard with one call per city.

Delivery ETA adjuster

Add buffer time automatically when rain or high wind is forecast.

Outdoor planner

Score the next 7 days for a chosen activity using temperature and UV.

Wrapping up

If your project needs weather widgets, the Weather API API removes the part nobody enjoys building. It's one of 23 in the DataNest collection — grab a free key and make your first call.

Weather API updates

New Weather API guides and endpoint updates, occasionally.