Posted on Tue, 25 Sep 2018 by Paulo
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?
Replies
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
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