登录 注册

历史天气API接口

  • 请求限制:
  • 5秒1次
  • 计费方式:
  • 包年/永久
  • 价格:
  • 2800/年起
  • 发票:
  • 普票/电子票/专票
功能介绍

可查询自2011年至今日的所有历史天气数据,返回当月天气列表,包含日期、天气情况、白天温度、夜间温度、风力风向、空气质量以及本月信息汇总(平均高温、平均低温、最差空气质量、最优空气质量、最差空气日期、最优空气日期)。

请求方式及url:

  • 请求方式:GET

接口地址:(建议在服务端设置线路地址为动态可修改的)

  • 线路1(推荐)https://v0.yiketianqi.com/api
  • 线路2:https://yiketianqi.com/api

请求示例

https://tianqiapi.com/api?version=history&appid=&appsecret=&city=青岛&year=2018&month=5

请求参数说明:

参数名 必选 类型 说明 备注(示例)
appid string 用户appid 注册开发账号
appsecret string 用户appsecret
version string 接口版本标识 固定值: history 每个接口的version值都不一样
year string 年份 如: 2015
month string 月份 如: 5
cityid string 城市ID 请参考 城市ID列表
city string 城市名称 不要带市和区; 如: 青岛、铁西

备注

cityid、city参数2选一提交,该接口限制为最快5秒一次。

响应JSON
{
    "cityid":"101120201",
    "date":"20185",
    "city":"青岛",
    "cityEn":"qingdao",
    "avgbWendu":"20", #平均高温
    "avgyWendu":"14", #平均低温
    "maxWendu":"27(2018-05-18)", #最高温度和日期
    "minWendu":"11(2018-05-03)", #最低温度和日期
    "avgAqi":"57", #平均空气质量
    "minAqi":"35", #最优空气质量
    "minAqiDate":"(05月22日)", #最优空气日期
    "minAqiInfo":"优",
    "minAqiLevel":"",
    "maxAqi":"105", #最差空气质量
    "maxAqiDate":"(05月24日)", #最差空气质量日期
    "maxAqiInfo":"轻度",
    "maxAqiLevel":"",
    "data":[
        {
            "ymd":"2018-05-01",
            "bWendu":"15°", #高温
            "yWendu":"12°", #低温
            "tianqi":"雾~雷阵雨", #天气情况
            "fengxiang":"南风", #风向
            "fengli":"3-4级", #风力等级
            "aqi":"56", #空气质量
            "aqiInfo":"良", #空气质量等级
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-02",
            "bWendu":"20°",
            "yWendu":"12°",
            "tianqi":"阴~晴",
            "fengxiang":"北风",
            "fengli":"4-5级",
            "aqi":"49",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-03",
            "bWendu":"22°",
            "yWendu":"11°",
            "tianqi":"多云~晴",
            "fengxiang":"北风",
            "fengli":"4-5级",
            "aqi":"51",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-04",
            "bWendu":"18°",
            "yWendu":"14°",
            "tianqi":"晴",
            "fengxiang":"西南风",
            "fengli":"4-5级",
            "aqi":"57",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-05",
            "bWendu":"16°",
            "yWendu":"13°",
            "tianqi":"小到中雨",
            "fengxiang":"西南风",
            "fengli":"4-5级",
            "aqi":"82",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-06",
            "bWendu":"22°",
            "yWendu":"14°",
            "tianqi":"阴~晴",
            "fengxiang":"东北风",
            "fengli":"3-4级",
            "aqi":"48",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-07",
            "bWendu":"23°",
            "yWendu":"13°",
            "tianqi":"多云~晴",
            "fengxiang":"北风",
            "fengli":"3-4级",
            "aqi":"66",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-08",
            "bWendu":"23°",
            "yWendu":"11°",
            "tianqi":"晴",
            "fengxiang":"北风",
            "fengli":"3-4级",
            "aqi":"86",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-09",
            "bWendu":"20°",
            "yWendu":"12°",
            "tianqi":"晴",
            "fengxiang":"北风",
            "fengli":"3-4级",
            "aqi":"61",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-10",
            "bWendu":"17°",
            "yWendu":"13°",
            "tianqi":"晴~多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"46",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-11",
            "bWendu":"16°",
            "yWendu":"13°",
            "tianqi":"多云~小雨",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"42",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-12",
            "bWendu":"17°",
            "yWendu":"14°",
            "tianqi":"多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"49",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-13",
            "bWendu":"19°",
            "yWendu":"14°",
            "tianqi":"多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"49",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-14",
            "bWendu":"19°",
            "yWendu":"14°",
            "tianqi":"晴~多云",
            "fengxiang":"南风",
            "fengli":"4-5级",
            "aqi":"69",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-15",
            "bWendu":"18°",
            "yWendu":"15°",
            "tianqi":"多云~雷阵雨",
            "fengxiang":"南风",
            "fengli":"4-5级",
            "aqi":"46",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-16",
            "bWendu":"20°",
            "yWendu":"17°",
            "tianqi":"雷阵雨~阵雨",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"50",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-17",
            "bWendu":"23°",
            "yWendu":"17°",
            "tianqi":"雾~多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"48",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-18",
            "bWendu":"27°",
            "yWendu":"16°",
            "tianqi":"多云",
            "fengxiang":"北风",
            "fengli":"3-4级",
            "aqi":"61",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-19",
            "bWendu":"19°",
            "yWendu":"14°",
            "tianqi":"晴~阵雨",
            "fengxiang":"东北风",
            "fengli":"3-4级",
            "aqi":"54",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-20",
            "bWendu":"17°",
            "yWendu":"14°",
            "tianqi":"阵雨~多云",
            "fengxiang":"东南风",
            "fengli":"4-5级",
            "aqi":"39",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-21",
            "bWendu":"18°",
            "yWendu":"15°",
            "tianqi":"多云~小雨",
            "fengxiang":"东南风",
            "fengli":"3-4级",
            "aqi":"40",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-22",
            "bWendu":"18°",
            "yWendu":"13°",
            "tianqi":"小到中雨~多云",
            "fengxiang":"东南风",
            "fengli":"3-4级",
            "aqi":"35",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-23",
            "bWendu":"22°",
            "yWendu":"16°",
            "tianqi":"晴",
            "fengxiang":"北风",
            "fengli":"3-4级",
            "aqi":"88",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-24",
            "bWendu":"22°",
            "yWendu":"16°",
            "tianqi":"晴",
            "fengxiang":"南风",
            "fengli":"4-5级",
            "aqi":"105",
            "aqiInfo":"轻度",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-25",
            "bWendu":"20°",
            "yWendu":"15°",
            "tianqi":"多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"78",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-26",
            "bWendu":"20°",
            "yWendu":"15°",
            "tianqi":"晴~阴",
            "fengxiang":"东南风",
            "fengli":"3-4级",
            "aqi":"45",
            "aqiInfo":"优",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-27",
            "bWendu":"21°",
            "yWendu":"16°",
            "tianqi":"多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"51",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-28",
            "bWendu":"21°",
            "yWendu":"17°",
            "tianqi":"多云",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"55",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-29",
            "bWendu":"24°",
            "yWendu":"16°",
            "tianqi":"多云",
            "fengxiang":"北风",
            "fengli":"3-4级",
            "aqi":"55",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-30",
            "bWendu":"23°",
            "yWendu":"16°",
            "tianqi":"多云~晴",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"62",
            "aqiInfo":"良",
            "aqiLevel":""
        },
        {
            "ymd":"2018-05-31",
            "bWendu":"24°",
            "yWendu":"16°",
            "tianqi":"晴",
            "fengxiang":"南风",
            "fengli":"3-4级",
            "aqi":"50",
            "aqiInfo":"优",
            "aqiLevel":""
        }
    ]
}
示例代码
$ curl "https://tianqiapi.com/api?version=history&appid=&appsecret=&city=青岛&year=2018&month=5"
错误码参考
字段 错误码 说明
errcode 100 该接口有任何异常报错都会返回errcode报错, 并且只有100, 具体报错描述请参考字段:errmsg
{
    "errcode":100,
    "errmsg":"缺少注册参数appid或appsecret"
}
  • 服务商:
  • 济南易客云网络科技有限公司
  • 认证状态:
  • 客服电话:
  • 0531-67820804
  • 对接QQ:
  • 445899710
  • 对接微信:

济南易客云网络科技有限公司. 网站备案号:鲁ICP备20002338号-3