热门城市查询

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

请求路径#

GET /geo/v2/city/top

参数#

查询参数

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

请求示例#

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://your-api-host/geo/v2/city/top?range=cn&number=10&lang=zh'

请将your_token替换为你的JWT身份认证,将your_api_host替换为你的API Host

试一下

返回数据#

{
  "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": [
      "https://developer.qweather.com/attribution.html"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code string 状态码
  • topCityList object 热门城市/地区列表
    • name string 位置名称
    • id string 位置ID
    • lat string 纬度
    • lon string 经度
    • adm2 string 上级行政区划名称
    • adm1 string 一级行政区域名称
    • country string 国家名称
    • tz string 时区
    • utcOffset string 当前位置与UTC时间偏移的小时数
    • isDst string 是否处于夏令时1 表示当前处于夏令时,0 表示当前不是夏令时
    • type string 位置的属性
    • rank string 位置的评分
    • fxLink uri 该位置的天气预报网页链接,便于嵌入你的网站或应用
  • refer object 数据来源和许可信息
    • sources array 原始数据来源,或数据源说明,可能为空
    • license array 数据许可或版权声明,可能为空