How do I use WeatherAPI in Appinventor?

How do I use WeatherAPI in App Inventor?
Here are my code blocks:

And here is a sample .json of the data that the Web component gets:

{
    "location": {
        "name": "Nashville",
        "region": "Tennessee",
        "country": "United States of America",
        "lat": 41.13,
        "lon": -85.13,
        "tz_id": "America/Indiana/Indianapolis",
        "localtime_epoch": 1669941288,
        "localtime": "2022-12-01 19:34"
    },
    "current": {
        "last_updated_epoch": 1669941000,
        "last_updated": "2022-12-01 19:30",
        "temp_c": -3.3,
        "temp_f": 26.1,
        "is_day": 0,
        "condition": {
            "text": "Partly cloudy",
            "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png",
            "code": 1003
        },
        "wind_mph": 3.8,
        "wind_kph": 6.1,
        "wind_degree": 110,
        "wind_dir": "ESE",
        "pressure_mb": 1030.0,
        "pressure_in": 30.41,
        "precip_mm": 0.0,
        "precip_in": 0.0,
        "humidity": 71,
        "cloud": 25,
        "feelslike_c": -7.4,
        "feelslike_f": 18.7,
        "vis_km": 16.0,
        "vis_miles": 9.0,
        "uv": 1.0,
        "gust_mph": 10.1,
        "gust_kph": 16.2,
        "air_quality": {
            "co": 240.3000030517578,
            "no2": 7.300000190734863,
            "o3": 51.5,
            "so2": 0.6000000238418579,
            "pm2_5": 2.5,
            "pm10": 3.0,
            "us-epa-index": 1,
            "gb-defra-index": 1
        }
    }

How do I implement this? When it looks up the dictionary values, it returns the block in the "Not Found" section. I do not have an .aia for this project because I am trying to get the API to work first.

I don't think so any problem

Use web component to decode the json

I have used the following blocks

2 Likes

Thank you, this worked! I needed to use Web1.JsonTextDecode instead of Web1.JsonTextDecodeWithDictionaries.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.