gpt4 book ai didi

java - 无法调用 Openweathermap API

转载 作者:行者123 更新时间:2023-11-29 04:44:38 26 4
gpt4 key购买 nike

我目前正在学习如何通过学习 Udacity 关于构建天气应用程序的 Android 类(class)来创建 Android 应用程序。一项要求是使用 http://api.openweathermap.org/data/2.5/forecast/daily?id=7839805&mode=json&units=metric&cnt=7&appid=[my api key] 调用 openweathermap API。

但是,我总是以

结束
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}

如何获取正确的API?

最佳答案

在 openweathermap 上创建一个帐户。您将获得 API key 。在 URL 中替换它:

http://api.openweathermap.org/data/2.5/forecast/daily?id=7839805&mode=json&units=metric&cnt=7&appid=[my api key]

您将能够获得正确的 JSON 响应。

关于java - 无法调用 Openweathermap API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37740714/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com