I'm trying to access the api using an ESP8266 as client. Identical request runs fine in other well known weather API but Weatherbit returns error 400.

Connected to api.weatherbit.io HTTP port 80 without issues. My request is the following:

GET v2.0forecast3hourly?city=Vila do Conde,PT&days=1&lang=PT&key=MySecretKey HTTP1.1 Host: api.weatherbit.io User-Agent: wget1.12 Connection: close

Response:

HTTP1.0 400 Bad request Cache-Control: no-cache Connection: close Content-Type: texthtml

htmlbodyh1400 Bad requesth1 Your browser sent an invalid request. bodyhtml

I'm i missing something?

Category: API

Replies

John says:
September, Wednesday, 2018 at 8:38PM

You may want to verify that the correct API request is being sent. There does not appear to be any issue with the API.

Thanks,
John at Weatherbit

Paulo says:
October, Wednesday, 2018 at 1:56PM

For future reference. whitespace in the URL was unencoded.

forecast3hourly?city=Vila do Conde,PT&days=1&lang=PT&key=MySecretKey

Should be:

forecast3hourly?city=Vila%20do%20Conde,PT&days=1&lang=PT&key=MySecretKey

Leave A Reply

What is two plus 7?