我正在开发一个天气应用程序,我正在尝试使用来自 worldweatheronline.com 网站的 API。但我的问题是如何开始在我的网站中使用这个天气 API。因为我已经阅读了 SO 的问题并且不清楚解决方案如何将天气 api 集成到我的网站中?. 所以请帮助我如何使用 Javascript 开始使用这些 API。任何例子将不胜感激。请记住,我是网络应用 API 使用的新手。
我从网站上得到的回复是
Request URI
http://api.worldweatheronline.com/free/v1/search.ashx?q=Chennai&format=json&key=53jjtnrm9d5jucpmxyyhj7vn
请求标头 { "X-Originating-Ip": "14.140.167.22" }
Response Headers
{
"Age": "0",
"Cache-Control": "public, no-cache=\"Set-Cookie\", max-age=120",
"Content-Type": "application/json; charset=utf-8",
"Date": "Mon, 16 Sep 2013 09:02:34 GMT",
"Server": "Microsoft-IIS/7.5",
"X-Aspnet-Version": "4.0.30319",
"X-Cache": "MISS",
"X-Mashery-Responder": "prod-j-worker-eu-west-1a-96.mashery.com",
"X-Powered-By": "UKFast Webcelerator",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive"
}
Response Body
{
"search_api": {
"result": [{
"areaName": [{
"value": "Chennai"
}],
"country": [{
"value": "India"
}],
"latitude": "13.083",
"longitude": "80.283",
"population": "0",
"region": [{
"value": "Tamil Nadu"
}],
"weatherUrl": [{
"value": "http:\/\/www.worldweatheronline.com\/Chennai-weather\/Tamil-Nadu\/IN.aspx"
}]
}]
}
}