MobSDK
  • 快速集成推送服务
  • 用数据驱动产品
  • 快速拥有手机短信验证功能
  • 实现Web与App的无缝链接
  • 轻松实现社会化功能
  • 最完美手游录像方案
  • 实现即时聊天功能
  • Discuz论坛移动化解决方案
  • 更方便的集成第三方支付
  • 快速搭建您的商城系统
  • 零成本搭建APP用户系统
  • 一步生成您的新闻APP
  • 为开发者提供各种数据
  • 解决用户快速增长与变现

天气预报 永久免费 支持HTTPS

查询当天及未来天气的基本情况,以及查询支持的城市列表。

提供天气信息包括:当前时间、当前气温、当前湿度,天气情况、污染指数、风向、风速、日出日落时间以及未来十天天气状况等。

API

  • 根据城市名查询天气
  • 城市列表查询接口
  • 根据IP查询天气

错误码参照

  • 根据城市名查询天气
  • 城市列表查询接口
  • 根据IP查询天气

价格套餐

  • 根据城市名查询天气
  • 城市列表查询接口
  • 根据IP查询天气

根据城市名查询天气

接口地址:http://apicloud.mob.com/v1/weather/query

支持格式:JSON

请求方式:GET

请求示例:http://apicloud.mob.com/v1/weather/query?key=appkey&city=通州&province=北京

备注说明:仅支持国内的天气查询,具体城市可根据支持的城市列表API来查询。可以通过城市名称进行查询。

请求参数:

name type N D value
key string 用户申请的appkey
city string 城市名(url编码) 南京
province string 当前城市的所属省份 如:北京-通州、江苏-通州(url编码) 江苏

返回字段:

name type N D value
retCode string 返回码
msg string 返回说明
result string 返回结果集
airCondition string 空气质量
city string 城市
coldIndex string 感冒指数
updateTime string 更新时间
date string 日期
distrct string 区县
dressingIndex string 穿衣指数
humidity string 湿度
pollutionIndex string 空气质量指数
province string 省份
sunset string 日落时间
sunrise string 日出时间
temperature string 温度
time string 时间
washIndex string 洗车指数
weather string 天气
week string 星期
wind string 风向
exerciseIndex string 运动指数
dayTime string 白天天气
night string 晚上天气

JSON返回示例:

                            {
    "msg": "success",
    "result": [
        {
            "airCondition": "良",
            "city": "北京",
            "coldIndex": "低发期",
            "updateTime": "20150908153820",
            "date": "2015-09-08",
            "distrct": "门头沟",
            "dressingIndex": "短袖类",
            "exerciseIndex": "适宜",
            "future": [
                {
                    "date": "2015-09-09",
                    "dayTime": "阵雨",
                    "night": "阴",
                    "temperature": "24°C\/18°C",
                    "week": "星期三",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-10",
                    "dayTime": "阵雨",
                    "night": "阵雨",
                    "temperature": "22°C\/15°C",
                    "week": "星期四",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-11",
                    "dayTime": "阴",
                    "night": "晴",
                    "temperature": "23°C\/15°C",
                    "week": "星期五",
                    "wind": "北风3~4级无持续风向小于3级"
                },
                {
                    "date": "2015-09-12",
                    "dayTime": "晴",
                    "night": "晴",
                    "temperature": "26°C\/13°C",
                    "week": "星期六",
                    "wind": "北风3~4级无持续风向小于3级"
                },
                {
                    "date": "2015-09-13",
                    "dayTime": "晴",
                    "night": "晴",
                    "temperature": "27°C\/16°C",
                    "week": "星期日",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-14",
                    "dayTime": "晴",
                    "night": "多云",
                    "temperature": "27°C\/16°C",
                    "week": "星期一",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-15",
                    "dayTime": "少云",
                    "night": "晴",
                    "temperature": "26°C\/14°C",
                    "week": "星期二",
                    "wind": "南风3级南风2级"
                },
                {
                    "date": "2015-09-16",
                    "dayTime": "局部多云",
                    "night": "少云",
                    "temperature": "26°C\/15°C",
                    "week": "星期三",
                    "wind": "南风3级南风2级"
                },
                {
                    "date": "2015-09-17",
                    "dayTime": "阴天",
                    "night": "局部多云",
                    "temperature": "26°C\/15°C",
                    "week": "星期四",
                    "wind": "东南风2级"
                }
            ],
            "humidity": "湿度:46%",
            "province": "北京",
            "sunset": "18:37",
            "sunrise": "05:49",
            "temperature": "25℃",
            "time": "14:35",
            "washIndex": "不适宜",
            "weather": "多云",
            "week": "周二",
            "wind": "南风2级"
        }
    ],
    "retCode": "200"
}
                        

错误代码:

name type N D value
20401 城市参数为空
20402 查询不到该城市的天气

价格套餐:

name type N D value
免费套餐 免费 无限次

城市列表查询接口

接口地址:http://apicloud.mob.com/v1/weather/citys

支持格式:JSON

请求方式:GET

请求示例:http://apicloud.mob.com/v1/weather/citys?key=appkey

备注说明:天气预报支持的城市。

请求参数:

name type N D value
key string 用户申请的appkey

返回字段:

name type N D value
retCode string 返回码
msg string 返回说明
result string 返回结果集
province string 省份
city array 城市
district array 区县

JSON返回示例:

                            {
    "msg": "success",
    "result": [
        {
            "city": [
                {
                    "city": "合肥",
                    "district": [
                        {
                            "district": "合肥"
                        },
                        {
                            "district": "长丰"
                        },
                        {
                            "district": "肥东"
                        },
                        {
                            "district": "肥西"
                        },
                        {
                            "district": "巢湖"
                        },
                        {
                            "district": "庐江"
                        }
                    ]
                },
                {
                    "city": "蚌埠",
                    "district": [
                        {
                            "district": "蚌埠"
                        },
                        {
                            "district": "怀远"
                        },
                        {
                            "district": "固镇"
                        },
                        {
                            "district": "五河"
                        }
                    ]
                },
                {
                    "city": "芜湖",
                    "district": [
                        {
                            "district": "芜湖"
                        },
                        {
                            "district": "繁昌"
                        },
                        {
                            "district": "芜湖县"
                        },
                        {
                            "district": "南陵"
                        },
                        {
                            "district": "无为"
                        }
                    ]
                },
                {
                    "city": "淮南",
                    "district": [
                        {
                            "district": "淮南"
                        },
                        {
                            "district": "凤台"
                        },
                        {
                            "district": "潘集"
                        }
                    ]
                },
                {
                    "city": "马鞍山",
                    "district": [
                        {
                            "district": "马鞍山"
                        },
                        {
                            "district": "当涂"
                        },
                        {
                            "district": "含山"
                        },
                        {
                            "district": "和县"
                        }
                    ]
                }
            ]
        }
    ]
}
                        

错误代码:

name type N D value
10001 appkey不合法!
10020 接口维护!

价格套餐:

name type N D value
免费套餐 免费 无限次

根据IP查询天气

接口地址:http://apicloud.mob.com/v1/weather/ip

支持格式:JSON

请求方式:GET

请求示例:http://apicloud.mob.com/v1/weather/ip?key=appkey&ip=115.239.210.27

备注说明:根据IP地址查询IP地址所在地的天气预报。

请求参数:

name type N D value
key string 用户申请的key
ip string ip地址 115.239.210.27
province string 当前城市的所属省份 如:北京-通州、江苏-通州 江苏

返回字段:

name type N D value
retCode string 返回码
msg string 返回说明
result string 返回结果集
airCondition string 空气质量
city string 城市
coldIndex string 感冒指数
updateTime string 更新时间
date string 日期
distrct string 区县
dressingIndex string 穿衣指数
humidity string 湿度
pollutionIndex string 空气污染指数
province string 省份
sunset string 日落时间
sunrise string 日出时间
temperature string 温度
time string 时间
washIndex string 洗车指数
weather string 天气
week string 星期
wind string 风向
exerciseIndex string 运动指数

JSON返回示例:

                            {
    "msg": "success",
    "result": [
        {
            "airCondition": "良",
            "city": "北京",
            "coldIndex": "低发期",
            "updateTime": "20150908153820",
            "date": "2015-09-08",
            "distrct": "门头沟",
            "dressingIndex": "短袖类",
            "exerciseIndex": "适宜",
            "future": [
                {
                    "date": "2015-09-09",
                    "dayTime": "阵雨",
                    "night": "阴",
                    "temperature": "24°C\/18°C",
                    "week": "星期三",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-10",
                    "dayTime": "阵雨",
                    "night": "阵雨",
                    "temperature": "22°C\/15°C",
                    "week": "星期四",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-11",
                    "dayTime": "阴",
                    "night": "晴",
                    "temperature": "23°C\/15°C",
                    "week": "星期五",
                    "wind": "北风3~4级无持续风向小于3级"
                },
                {
                    "date": "2015-09-12",
                    "dayTime": "晴",
                    "night": "晴",
                    "temperature": "26°C\/13°C",
                    "week": "星期六",
                    "wind": "北风3~4级无持续风向小于3级"
                },
                {
                    "date": "2015-09-13",
                    "dayTime": "晴",
                    "night": "晴",
                    "temperature": "27°C\/16°C",
                    "week": "星期日",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-14",
                    "dayTime": "晴",
                    "night": "多云",
                    "temperature": "27°C\/16°C",
                    "week": "星期一",
                    "wind": "无持续风向小于3级"
                },
                {
                    "date": "2015-09-15",
                    "dayTime": "少云",
                    "night": "晴",
                    "temperature": "26°C\/14°C",
                    "week": "星期二",
                    "wind": "南风3级南风2级"
                },
                {
                    "date": "2015-09-16",
                    "dayTime": "局部多云",
                    "night": "少云",
                    "temperature": "26°C\/15°C",
                    "week": "星期三",
                    "wind": "南风3级南风2级"
                },
                {
                    "date": "2015-09-17",
                    "dayTime": "阴天",
                    "night": "局部多云",
                    "temperature": "26°C\/15°C",
                    "week": "星期四",
                    "wind": "东南风2级"
                }
            ],
            "humidity": "湿度:46%",
            "pollutionIndex": "污染指数54",
            "province": "北京",
            "sunset": "18:37",
            "sunrise": "05:49",
            "temperature": "25℃",
            "time": "14:35",
            "washIndex": "不适宜",
            "weather": "多云",
            "week": "周二",
            "wind": "南风2级"
        }
    ],
    "retCode": "200"
}
                        

错误代码:

name type N D value
20404 IP地址错误
20405 查询不到该IP地址相关的天气信息
20402 查询不到该城市的天气

价格套餐:

name type N D value
免费套餐 免费 无限次
MobSDK后台打包中:
查看
MobSDK打包中
正在根据你选择的SDK打包中:
取消下载
免费咨询
扫一扫添加公众号
24小时在线免费咨询