invrt
invrt

Reputation: 709

Browser get request 404'd but works with Postman app

Title says it all, trying to retrieve some data with the openweather api.

It works fine on Postman, however when using vanillaJS in a local environment I get an error message in console

ERROR: GET http://127.0.0.1:5500/api.openweathermap.org/data/2.5/forecast?id=2193733&appid=MYAPIKEY 404 (Not Found)

My code looks like this

axios.get(`api.openweathermap.org/data/2.5/forecast?id=2193733&appid=MYAPIKEY`)
         .then(response => {
             console.log(response);
         })

Any ideas?

Upvotes: 1

Views: 367

Answers (1)

Japsz
Japsz

Reputation: 785

You are getting the request Sent on top of your app that's running axios.

Try axios.get('http://api.openwheather...') and it should work

Upvotes: 2

Related Questions