[英]Can't call Openweather map API
我正在學習如何通過關注Udacity的Android課程來構建一個天氣應用程序來創建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密鑰。 在URL中替換它:
http://api.openweathermap.org/data/2.5/forecast/daily?id=7839805&mode=json&units=metric&cnt=7&appid=[my api key]
並且您將能夠獲得正確的JSON響應。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.