全國(guó)天氣預(yù)報(bào)信息 API 接口
精確到行政區(qū)的7日天氣預(yù)報(bào)卷扮。
1. 產(chǎn)品功能
支持通過(guò)地理坐標(biāo)盗舰、區(qū)域編碼兩種形式查詢(xún)對(duì)應(yīng)地區(qū)的天氣信息庭瑰;
全國(guó)天氣預(yù)報(bào)每隔 6 小時(shí)更新數(shù)據(jù);
精確到行政區(qū)級(jí)別的天氣預(yù)報(bào)數(shù)據(jù)危喉;
提供最長(zhǎng) 7 天的天氣預(yù)報(bào)數(shù)據(jù)宋渔;
提供每日小時(shí)級(jí)別的天氣預(yù)報(bào)數(shù)據(jù);
提供本地日出日落辜限、當(dāng)日歷史溫度等附加數(shù)據(jù)傻谁;
提供紫外線(xiàn)、穿衣列粪、洗車(chē)、空氣污染等額外指導(dǎo)數(shù)據(jù)谈飒;
全接口支持 HTTPS(TLS v1.0 / v1.1 / v1.2 / v1.3)岂座;
全面兼容 Apple ATS;
全國(guó)多節(jié)點(diǎn) CDN 部署杭措;
接口極速響應(yīng)费什,多臺(tái)服務(wù)器構(gòu)建 API 接口負(fù)載均衡。
2. API 文檔
API 詳情地址: https://www.gugudata.com/api/details/weatherinfo
接口請(qǐng)求地址: https://api.gugudata.com/weather/weatherinfo
返回格式: application/json; charset=utf-8
請(qǐng)求方式: GET
請(qǐng)求協(xié)議: HTTPS
請(qǐng)求示例: https://api.gugudata.com/weather/weatherinfo?appkey=YOUR_APPKEY&code=YOUR_VALUE&days=1
接口測(cè)試: https://api.gugudata.com/weather/weatherinfo/demo
前置接口
前置接口說(shuō)明: 查詢(xún)地區(qū)編碼手素,根據(jù)市或區(qū)的關(guān)鍵字進(jìn)行查詢(xún)鸳址,如北京、蘇州泉懦、海淀稿黍、吳中等
前置接口參數(shù)說(shuō)明: appkey=YOUR_APPKEY&keyword=查詢(xún)編碼的市或區(qū)關(guān)鍵字巡球,如北京、海淀
前置接口返回格式: application/json; charset=utf-8
前置接口返回說(shuō)明: 包含地區(qū)編碼以及省邓嘹、市酣栈、區(qū)相關(guān)信息
前置接口請(qǐng)求方式: GET
前置接口請(qǐng)求協(xié)議: HTTPS
3. 請(qǐng)求參數(shù)
參數(shù)名 | 參數(shù)類(lèi)型 | 是否必須 | 默認(rèn)值 | 備注 |
---|---|---|---|---|
appkey | string | 是 | YOUR_APPKEY | 付費(fèi)后獲取的 APPKEY |
code | string | 是 | YOUR_VALUE | 地理坐標(biāo)或地區(qū)編碼。當(dāng)傳遞地理坐標(biāo)時(shí)汹押,格式為: [經(jīng)度,緯度]矿筝,如:[120.730724,31.31592];如果傳遞地區(qū)編碼棚贾,那么可通過(guò)前置接口查詢(xún)獲得地區(qū)編碼窖维。 |
days | int | 否 | 1 | 獲取天氣預(yù)報(bào)的天數(shù),默認(rèn)為1鸟悴,即為當(dāng)天數(shù)據(jù)陈辱。最大值為7。 |
4. 返回參數(shù)
參數(shù)名 | 參數(shù)類(lèi)型 | 備注 |
---|---|---|
DataStatus.StatusCode | int | 接口返回狀態(tài)碼 |
DataStatus.StatusDescription | string | 接口返回狀態(tài)說(shuō)明 |
DataStatus.ResponseDateTime | string | 接口數(shù)據(jù)返回時(shí)間 |
DataStatus.DataTotalCount | int | 此條件下的總數(shù)據(jù)量 |
Data.Code | string | 地區(qū)編碼 |
Data.CodeAddress | string | 如果傳遞的查詢(xún)參數(shù)為地理坐標(biāo)细诸,那么該字段將返回地理坐標(biāo)反解析之后的行政區(qū)劃信息沛贪,格式為: 省份,市,區(qū),街道/鎮(zhèn),POI地址,詳細(xì)地址,如: 江蘇省,蘇州市,吳中區(qū),斜塘街道,東湖·春之韻,會(huì)心街99號(hào)(金塔橋以西,鴻禧橋以北);如果傳遞的查詢(xún)參數(shù)是地區(qū)編碼利赋,那么此字段值為 null水评,具體值可通過(guò) Data.WeatherRegion 獲取。 |
Data.WeatherDate | string | 天氣預(yù)報(bào)的日期 |
Data.WeatherRegion | object | 當(dāng)前天氣預(yù)報(bào)的詳細(xì)地區(qū)信息媚送,數(shù)據(jù)格式與查詢(xún)地區(qū)編碼接口返回?cái)?shù)據(jù)格式一致中燥。 |
Data.WeatherRegion.ReginType | string | 位置信息類(lèi)型,2為市級(jí)別數(shù)據(jù)塘偎,3為區(qū)級(jí)別數(shù)據(jù) |
Data.WeatherRegion.Code | string | 地區(qū)完整編碼 |
Data.WeatherRegion.ProvinceCode | string | 省編碼 |
Data.WeatherRegion.ProvinceName | string | 省名稱(chēng) |
Data.WeatherRegion.CityCode | string | 市編碼 |
Data.WeatherRegion.CityName | string | 市名稱(chēng) |
Data.WeatherRegion.RegionCode | string | 區(qū)編碼 |
Data.WeatherRegion.RegionName | string | 區(qū)名稱(chēng) |
Data.WeatherRegion.TownCode | string | 鎮(zhèn)編碼 |
Data.WeatherRegion.TownName | string | 鎮(zhèn)名稱(chēng) |
Data.WeatherInfo | string | 天氣情況 |
Data.TemperatureHigh | int | 最高溫度 |
Data.TemperatureLow | int | 最低溫度 |
Data.TodayHistoryHighestTemperature | int | 當(dāng)日歷史最高溫度 |
Data.TodayHistoryLowestTemperature | int | 當(dāng)日歷史最低溫度 |
Data.WeatherWindCondition1 | string | 風(fēng)向1 |
Data.WeatherWindCondition2 | string | 風(fēng)向2 |
Data.WeatherWindLevel | string | 風(fēng)級(jí) |
Data.SunRiseTime | string | 日出時(shí)間 |
Data.SunSetTime | string | 日落時(shí)間 |
Data.WeatherPerHour | array | 當(dāng)日小時(shí)級(jí)別的天氣預(yù)報(bào)數(shù)據(jù)數(shù)組 |
Data.WeatherPerHour.WeatherTime | string | 預(yù)報(bào)的小時(shí)時(shí)間疗涉,24小時(shí)制 |
Data.WeatherPerHour.WeatherInfo | string | 天氣情況 |
Data.WeatherPerHour.Temperature | string | 溫度 |
Data.WeatherPerHour.WeatherWindCondition | string | 風(fēng)向 |
Data.WeatherPerHour.WeatherWindLevel | string | 風(fēng)級(jí) |
Data.LifeHelperUV | object | UV指數(shù) |
Data.LifeHelperWear | object | 穿衣指數(shù) |
Data.LifeHelperWashCar | object | 洗車(chē)指數(shù) |
Data.LifeHelperAir | object | 空氣指數(shù) |
Data.LifeHelper.HelperName | string | 指數(shù)名稱(chēng) |
Data.LifeHelper.HelperStatus | string | 指數(shù)狀態(tài) |
Data.LifeHelper.HelperValue | string | 指數(shù)值∫髦龋總分:紫外線(xiàn)5分咱扣,穿衣7分,洗車(chē)4分涵防,空氣5分 |
Data.LifeHelper.HelperContent | string | 指數(shù)內(nèi)容 |
Data.WeatherDataGenerateDateTime | string | 天氣預(yù)報(bào)內(nèi)容數(shù)據(jù)生成時(shí)間 |