OpenWeatherMap
This sample illustrates the communication with an HTTPS/REST API. HTTPS GET requests are sent to obtain weather data from the OpenWeatherMap REST API. The response of the web service containing the data is in a JSON format.

To send requests to the OpenWeatherMap REST API, the user must create an account for OpenWeatherMap to receive an application ID. In combination with a location identifier (e.g. latitude/longitude, city ID, city name), the application ID can be used to query weather data.
API documentation for various use cases (16-day forecast, current data etc.) can be found here: https://openweathermap.org/api.
PROGRAM MAIN
VAR
// trigger command execution for OpenWeatherMap samples
bGetOpenWeatherMap : BOOL;
fbHttpClientOpenWeatherMap : FB_IotHttpClient :=(sHostName:='api.openweathermap.org',
bKeepAlive:=TRUE, tConnectionTimeout:=T#10S);
fbHttpGetOpenWeatherMap : FB_TestHTTP_Get_openWeatherMap;
END_VAR
//init client parameters at startup
IF NOT fbHttpClientOpenWeatherMap.bConfigured THEN
fbHttpClientOpenWeatherMap.nHostPort:= 443;
fbHttpClientOpenWeatherMap.stTLS.bNoServerCertCheck:= TRUE;
END_IF
IF fbHttpClientOpenWeatherMap.bConfigured THEN
fbHttpGetOpenWeatherMap(bSend:=bGetOpenWeatherMap, fbClient:=fbHttpClientOpenWeatherMap);
END_IF
fbHttpClientOpenWeatherMap.Execute();
Further Information