I notice there are some changes in the usage of the weather API. For that reason I created a very simple sample with Node-RED to access the weather forecast. The Node-RED flow implements the access to the weather API you can use during your CallForCode challenge.
Here is what you need to do, to get access to the weather API:
- Register on Welcome to The Weather Company API Platform Site Powering the best Weather Apps & Sites
- You will get a mail with the apikey
- Then you can use the documentation to access the API
Please ensure you have following simple settings for your REST API request in place:
- The HTTP header must contain Accept-Encoding: gzip
The reason for that is, that all responses of the weather API requests are compressed. The Supported encoding format is: gzip
- Use the parameter apiKey
The following picture shows a simple postman this request:
Inside the flow you have to replace the text YOUR_WEATHER_APIKEY with the apiKey you got in your mail. Beware you have to install node-red-contrib-gzip in your Node-RED to use the sample. You can get the Node-RED flow from GitHub.
In the following gif you can see the usage of the flow:
For a more detailed understanding, how the weather service can be used in real world UseCases, please visit that awesome blog post from Va Barbosa All for code the weather company and you .
I hope this was useful for you and let’s see what’s next?
PS: By the way, you can use the IBM Cloud for free, if you simply create an IBM Lite account. Here you only need an e-mail address.
#IBMDeveloper, #CallForCode, #Node-RED, #WeatherAPI