☀
OpenWeather 当前
已测试可用GET天气与环境提供商: OpenWeather
获取当前天气
#天气#当前#温度#气象
请求地址
GET https://api.openweathermap.org/data/2.5/weather?q=London在线测试
GET
https://api.openweathermap.org/data/2.5/weather?q=London注册并登录后即可在线测试 API
请求参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| q | string | 否 | 查询关键字 |
| limit | number | 否 | 返回数量限制 |
JavaScriptfetch
fetch('https://api.openweathermap.org/data/2.5/weather?q=London')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));cURL命令行
curl "https://api.openweathermap.org/data/2.5/weather?q=London"