0 Replies Latest reply on Jun 5, 2017 10:37 AM by jkidane RSS
    jkidane Newbie

    Simple Weather Mashup Location error

    Attempting to recreate the simple weather mashup however when attempting to retrieve information i keep getting this error code.

    Here is my code with my own API key

    Could anyone help me resolve it?

    Additionally i have migrated to the Open Weather mapper already.

    Script:

    var test=Location+" ";

     

    var arrayLocations=test.split(",");

     

    var lat=arrayLocations[0];

     

    var long=arrayLocations[1];

     

    var prm = {

        url : "http://api.openweathermap.org/data/2.5/forecast?lat="+lat+"&lon="+long+"&units=metric&type=accurate&mode=xml&APPID=be9450fd4cd44ef21c44f3aeb1f90fa4",

        timeout: 160 /* NUMBER */ 

    };

     

     

    var xmlPage = Resources["ContentLoaderFunctions"].LoadXML(prm);

     

    // result: XML

     

     

    var params = {

     

        infoTableName : "InfoTable",

     

        dataShapeName : "OpenWeatherFeed"

     

    };

     

    var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

     

    var from_today_value=xmlPage.forecast.time[0].@from.substring(0,10);

     

    logger.warn("from_today_value= "+from_today_value);

     

    for each (var item in xmlPage.forecast.time) {

     

        var row = new Object();

     

        var from_current_value=item.@from.substring(0,10);

     

        row.WindDirection = item.windDirection.@name;

     

        row.WindSpeed=item.windSpeed.@mps;

     

        row.WeatherTemp=parseInt(item.temperature.@value);

     

        row.WeatherHumidity=parseFloat(item.humidity.@value);

     

        row.From =  item.@from;

     

        row.To =  item.@to;

     

        row.Title=xmlPage.location.name+" "+xmlPage.location.country;

     

        //  row.Precipitation=(item.precipitation.@type+" "+item.precipitation.@value)==" "?"NoPrecipitation":item.precipitation.@type;

     

        result.AddRow(row);

    }