Ok so I’m struggling here to get my openweathermap Api to read and produce data, using the lat and lon coordinates I’ve given it.
I’m using ip.api.com and this is working, but when I try to pass these into openweather I cannot and I receive this message on the console:
“Failed to load resource: the server responded with a status of 401 (Unauthorized)”
It also shows that my lat and lon have been passed into the URL. Is this a cross origins issue? Should I scrap openweather and use something else like forcast.io, don’t want to mess about signing up for things I dont need to… I’m using Chrome btw.
I would re-examine the URL you are creating. You need to have “&APPID=” before the api key itself. Also the & symbol is not required before the first parameter.
You’re not adding the API key correctly to the url, what you’re doing is this: url + apiKey. What you need to do is: url + ‘&APPID=’ + apiKey. Also you have an extra }); at the end of your script that you need to remove.
I thought I’d completed this task, managed to get the temp to change from C to F, It was done. But I’ve done something to make the temperatures really high (unless its an api fault).
I’m not sure what because once it was complete I left the pc for 5 mins, came back and this has happened.
Can anybody see why this has happened? Ignore the rubbish design lol.