热门城市查询

平台: API iOS Android

获取全球各国热门城市列表。

请求URL

https://geoapi.qweather.com/v2/city/top

请求参数

请求参数包括必选和可选参数,如不填写可选参数将使用其默认值,参数之间使用 &进行分隔。

  • range搜索范围,可设定只在某个国家或地区范围内进行搜索,国家和地区名称需使用ISO 3166 所定义的国家代码。如果不设置此参数,搜索范围将在所有城市。例如 range=cn
  • number返回结果的数量,取值范围1-20,默认返回10个结果。
  • lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。

请求示例

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://geoapi.qweather.com/v2/city/top?number=5&range=cn'

请将your_token替换为你的JWT或了解身份认证

返回数据

返回数据是JSON格式并进行了Gzip压缩

{
  "code":"200",
  "topCityList":[
    {
      "name":"北京",
      "id":"101010100",
      "lat":"39.90499",
      "lon":"116.40529",
      "adm2":"北京",
      "adm1":"北京市",
      "country":"中国",
      "tz":"Asia/Shanghai",
      "utcOffset":"+08:00",
      "isDst":"0",
      "type":"city",
      "rank":"10",
      "fxLink":"https://www.qweather.com/weather/beijing-101010100.html"
    },
    {
      "name":"朝阳",
      "id":"101010300",
      "lat":"39.92149",
      "lon":"116.48641",
      "adm2":"北京",
      "adm1":"北京市",
      "country":"中国",
      "tz":"Asia/Shanghai",
      "utcOffset":"+08:00",
      "isDst":"0",
      "type":"city",
      "rank":"15",
      "fxLink":"https://www.qweather.com/weather/chaoyang-101010300.html"
    },
    {
      "name":"海淀",
      "id":"101010200",
      "lat":"39.95607",
      "lon":"116.31032",
      "adm2":"北京",
      "adm1":"北京市",
      "country":"中国",
      "tz":"Asia/Shanghai",
      "utcOffset":"+08:00",
      "isDst":"0",
      "type":"city",
      "rank":"15",
      "fxLink":"https://www.qweather.com/weather/haidian-101010200.html"
    },
    {
      "name":"深圳",
      "id":"101280601",
      "lat":"22.54700",
      "lon":"114.08595",
      "adm2":"深圳",
      "adm1":"广东省",
      "country":"中国",
      "tz":"Asia/Shanghai",
      "utcOffset":"+08:00",
      "isDst":"0",
      "type":"city",
      "rank":"13",
      "fxLink":"https://www.qweather.com/weather/shenzhen-101280601.html"
    },
    {
      "name":"上海",
      "id":"101020100",
      "lat":"31.23171",
      "lon":"121.47264",
      "adm2":"上海",
      "adm1":"上海市",
      "country":"中国",
      "tz":"Asia/Shanghai",
      "utcOffset":"+08:00",
      "isDst":"0",
      "type":"city",
      "rank":"11",
      "fxLink":"https://www.qweather.com/weather/shanghai-101020100.html"
    },
    {
      "name":"浦东新区",
      "id":"101020600",
      "lat":"31.24594",
      "lon":"121.56770",
      "adm2":"上海",
      "adm1":"上海市",
      "country":"中国",
      "tz":"Asia/Shanghai",
      "utcOffset":"+08:00",
      "isDst":"0",
      "type":"city",
      "rank":"15",
      "fxLink":"https://www.qweather.com/weather/pudong-101020600.html"
    }
  ],
  "refer":{
    "sources":[
      "QWeather"
    ],
    "license":[
      "QWeather Developers License"
    ]
  }
}
  • code 请参考状态码
  • topCityList.name 地区/城市名称
  • topCityList.id 地区/城市ID
  • topCityList.lat 地区/城市纬度
  • topCityList.lon 地区/城市经度
  • topCityList.adm2 地区/城市的上级行政区划名称
  • topCityList.adm1 地区/城市所属一级行政区域
  • topCityList.country 地区/城市所属国家名称
  • topCityList.tz 地区/城市所在时区
  • topCityList.utcOffset 地区/城市目前与UTC时间偏移的小时数,参考详细说明
  • topCityList.isDst 地区/城市是否当前处于夏令时1 表示当前处于夏令时,0 表示当前不是夏令时。
  • topCityList.type 地区/城市的属性
  • topCityList.rank 地区评分
  • topCityList.fxLink 该地区的天气预报网页链接,便于嵌入你的网站或应用
  • refer.sources 原始数据来源,或数据源说明,可能为空
  • refer.license 数据许可或版权声明,可能为空