欢迎您!

城市天气预报

接口标识: cityweather 价格: 0.0002 元/次 VIP免费
接口简介
通过城市名称、城市ID或IP地址查询天气预报信息,支持实时天气实况和24小时、15日、40日、100日多日预报,返回温度、湿度、风向风力、气压等完整气象数据。适用于生活服务平台、出行应用、智能硬件等场景。
详细介绍
接口地址: https://www.phpwc.cn/api/cityweather
请求方式: POST
业务请求参数
参数名类型必填默认值说明
content string 必填 林州 城市名称/城市cityId/IP地址
content_type string 必填 cityname 可选:cityname(城市名称)、ip(IP地址)、cityid(城市cityId)
time_type string 必填 realtime 可选:realtime(天气实况)、24hours(24小时预报)、15days(15日预报)、40days(40日预报)、100days(100日预报)。
响应参数
字段名类型说明
codeint状态码,0=成功
descstring状态描述
data− object 业务数据(成功时返回)
city− object 城市信息
city string 城市名
district string 区县
province string 省份
country string 国家
condition− object 天气实况数据(仅 time_type=realtime 时返回)
temperature string 当前温度(℃)
weather_desc string 天气描述(如:晴、多云)
weather_code string 天气代码
humidity string 相对湿度
wind_desc string 风向风力描述
air_pressure string 气压
visibility string 能见度
cloud_rate string 云量
feel_temperature string 体感温度(℃)
uv string 紫外线指数
sunrise string 日出时间
sunset string 日落时间
publish_time string 数据发布时间
hourly− array 24小时逐时预报数组(仅 time_type=24hours 时返回)
forecast_time string 预报时间
weather_code string 天气代码
weather_desc string 天气描述
temperature string 温度(℃)
feel_temperature string 体感温度(℃)
humidity string 相对湿度
wind_desc string 风向风力描述
air_pressure string 气压
visibility string 能见度
sunrise string 日出时间
sunset string 日落时间
forecast− array 多日预报数组(time_type 为 15days/40days/100days 时返回)
forecast_day string 预报日期
max_temperature string 最高温度(℃)
min_temperature string 最低温度(℃)
day_weather_desc string 白天天气描述
day_weather_code string 白天天气代码
night_weather_desc string 夜间天气描述
night_weather_code string 夜间天气代码
day_wind_desc string 白天风力描述
night_wind_desc string 夜间风力描述
day_wind_direction_desc string 白天风向
night_wind_direction_desc string 夜间风向
sunrise string 日出时间
sunset string 日落时间
day_humidity string 白天湿度
night_humidity string 夜间湿度
wind_level_rank string 风力等级(100days)
request_idstring请求追踪ID
JSON 示例:
调用成功:
{
  "code": 0,
  "desc": "success",
  "data": { ... },
  "request_id": "abc123..."
}
调用失败:
{
  "code": 999,
  "desc": "错误描述",
  "request_id": "abc123..."
}
请先 登录 后使用在线测试

© 网程科技(林州网程科技有限公司)   |  豫ICP备2025120409号-2   |  豫B2-20230220   |  豫公网安备 41058102000262号