Weather Challenge - URL Functioning Randomly

Hi all!

This url seems to work randomly: https://fcc-weather-api.glitch.me/api/current?lon=-122.29756359999999&lat=37.8843324

Sometimes it shows Shuzenji, Japan, and sometimes it shows Albany, CA. (I want it to show Albany, CA.)

Here’s how I tested it:

  • I enter the above link, and chrome loads the data for albany, ca. I close the page.
  • I repeat that a few times, and keep getting albany.
  • I repeat once more, and it shows Shuzenji, Japan. It keeps showing this for a few times.
  • After repeating a few more times, it starts showing Albany, CA again. And so on…

This happens on both Chrome and Safari, on MacBook and iPhone.

Shuzenji, Japan is at 34°58’03.3"N 138°53’58.2"E.
Albany, CA is at 37°53’08.2"N 122°17’52.2"W
so it’s not because of the negative sign in front of “122”

But just in case it’s the negative, I tried %2D instead of the minus sign…and still got the same random test results.

And same test results if I switch the order of lon and lat in the link.

Also tried clearing cache/cookies.

Any ideas how to return Albany, CA more consistently with the fcc-weather-api url format?

Thanks!

  • jan

Known issue.

https://forum.freecodecamp.org/t/seems-to-be-a-problem-with-the-fcc-weather-api/179165

1 Like

Awesome! Thank you so much! Now that I know Shuzenji is the default for when the API can’t access fresh data, I added this exception:

if (location == "Shuzenji, JP"){
      alert("We know you're probably not in Shuzenji. Please wait a minute and then try again.");

Of course, I might style this later within a div instead of in an alert…

Thank you!