Weather API Documentation
Introduction
Get accurate, live weather data by Lat/Long Coordinates for any location in the world.
Endpoints
The get_weather endpoint delivers the location’s temperature, wind speed, sunrise/sunset data and more when it receives a location in the form of a latitude and longitude.
Endpoint | URL | Method |
GET World Time | /v1/worldtime/ | GET |
Base URL
https://weather-by-based-api.p.rapidapi.com/v1/weather/
Validation Endpoint
weather-by-based-api.p.rapidapi.com/v1/weather/?location=-16.7591487,145.9731097
Headers
X-RapidAPI-Key
Your RapidAPI account key. The same key can be used across all of our APIs. You can create or find your existing Key here.
X-RapidAPI-Host
This is RapidAPIs base URL for the api:
world-time-by-based-api.p.rapidapi.com
Request Parameters
You require both a lat and long query parameter.
lat – This parameter accepts latitude as a string.
long – This parameter accepts longitude as a string.
lat | long |
-16.7591487 | 145.9731097 |
Example Request
Python:
import http.client conn = http.client.HTTPSConnection("weather-by-based-api.p.rapidapi.com") headers = { 'x-rapidapi-key': "your_rapid_api_key", 'x-rapidapi-host': "weather-by-based-api.p.rapidapi.com" } conn.request("GET", "/v1/weather/?lat=-16.7591487&lon=145.9731097", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
Example Response
{ "cloud_pct": 100, "temp": 20, "feels_like": 20, "humidity": 74, "min_temp": 20, "max_temp": 20, "wind_speed": 11.82, "wind_degrees": 128, "sunrise": 1721767423, "sunset": 1721808071 }