hi,
My WebRequest seems to not work on wifi
I do see this thread https://forums.garmin.com/developer/connect-iq/f/discussion/192741/makewebrequest-worked-with-http-but-now-not-with-https-does-invalid_http_body_in_network_response--400
but due to my lake of skills and my English I did not get anything... sorry about that.
So, I was reported many times the web request does not work with WIFI (after many tests)
here is my code (given by the Great Jim):
Do I have to change something? condition with Wifi?
Have a great day!
function makeRequest(lat, lng,apiKey) {
var UNITS=(Sys.getDeviceSettings().temperatureUnits==Sys.UNIT_STATUTE) ? "imperial" : "metric";
var url ="https://api.openweathermap.org/data/2.5/weather";
var param={
"lat" => lat,
"lon"=>lng,
"appid"=>apiKey,
"units" => UNITS};
var options = {
:methods => Comm.HTTP_REQUEST_METHOD_GET,
:headers => {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED},
:responseType => Comm.HTTP_RESPONSE_CONTENT_TYPE_JSON
};
Comm.makeWebRequest(
url,
param,
options,
method(:receiveWeather));
}