Ciao a tutti,
today a new extension to add weather forecast to your app. I used the AccuWeather API for this extension.
Before to use the extension You have to register your account on https://developer.accuweather.com/
then on My Apps, Add a new App, at this point You have the api key to use on your app inventor project with this extension.
With the AccuWeather API before to ask a forecast you have to know the location key of a city, to find the location key I added two function: CitySearchText and CitySearchGeoPos.
apiKey your api key.
city city to search for.
language String indicating the language in which to return the resource.
apiKey your api key.
lat latitude
lon longitude
language String indicating the language in which to return the resource.
After You call CitySearchText or CitySearchGeoPos, You will find the response on GotCity
responseCode 200 is the correct answer
response the complete response in json format if You need more information
locatioKey a list of location key that match your criteria
city a list of city that match your criteria
area a list of area where the cities found are located
message if there is an error here You find the message
Now You have the city location key and You can:
Forecast for 1 day
apiKey your api key.
locationKey the location key of the city you searched for
language String indicating the language in which to return the resource.
metric false Fahreneit true Celsius
Forecast for 5 days
apiKey your api key.
locationKey the location key of the city you searched for
language String indicating the language in which to return the resource.
metric false Fahreneit true Celsius
Call GotForecast to have the response of the two previous functions
responseCode 200 is the correct answer
response the complete response in json format if You need more information
textForecast the headline forecast
date a list with the forecast date
tempMin a list with the minimun temperature for each day
tempMax a list with the maximum temperature for each day
dayIcon a list with the forecast icon number for each day
dayPhrase a list with the forecast phrase for each day
nightIcon a list with the forecast icon number for each night
nightPhrase a list with the forecast phrase for each night
message if there is an error here You find the message
12 Hours of Hourly Forecast
apiKey your api key.
locationKey the location key of the city you searched for
language String indicating the language in which to return the resource.
metric false Fahreneit true Celsius
Call GotHourlyForecast to have the response of the previous function
responseCode 200 is the correct answer
response the complete response in json format if You need more information
dateTime a list with date and time of the forecast
icon a list with the forecast icon number for each hour
text a list with the forecast phrase for each hour
temp a list with the forecast temp hour
message if there is an error here You find the message
Current Conditions
apiKey your api key.
locationKey the location key of the city you searched for
language String indicating the language in which to return the resource.
Call GotCurrentConditions to have the response of the previous function
responseCode 200 is the correct answer
response the complete response in json format if You need more information
weather the forecast phrase
icon the forecast icon number
Accuweather with the Indices advises whether or not to do a certain activity for example go to the beach or bicycling or to know the air quality. You can find a complete list here AccuWeather APIs | List of Available Daily Indices
1Day Index
apiKey your api key.
locationKey the location key of the city you searched for
index specific index, check the list for the values
language String indicating the language in which to return the resource.
apiKey your api key.
locationKey the location key of the city you searched for
index specific index, check the list for the values
language String indicating the language in which to return the resource.
Call GotIndex to have the response of the previous function
responseCode 200 is the correct answer
response the complete response in json format if You need more information
name the index name
localDateTime a list with the date
value a list with the index value
text a list with text that explain the value
message if there is an error here You find the message
Source Code:
AccuWeather.txt (30.8 KB)
Extension:
AccuWeather.aix (34.0 KB)
Sample Project:
WeatherSample.aia (324.0 KB)
I hope You find useful
Ciao
Marco Perrone