3

是否可以按国家/地区从 openweathermap 获取 xml 数据?

当我在文档中搜索时,我注意到您可以通过以下不同方式进行搜索:

  • 按城市名称
  • 按地理坐标
  • 按城市 ID

例如:这是按城市名称获取数据的 url:

http://api.openweathermap.org/data/2.5/forecast/daily?q=Berlin&mode=xml&units=metric

因此,如果您只在一个国家/地区输入城市名称(柏林)q=?

http://api.openweathermap.org/data/2.5/forecast/daily?q=Germany&mode=xml&units=metric

我会收到一条错误消息: {"message":"","cod":"404"}

感谢帮助

4

0 回答 0