Kevin Powell - CommunityKP-C
Kevin Powell - Community3y ago
31 replies
CDL

Weather APP using weatherapi.com

The goal of this is to be able to show the current weather in a specific location (searchable). Now I have access to it, and I can see a Call (the url), and a response body (bunch of JSON).

Now... I know I can use fetch to access or pull (I think pull is the word), the API url, so does that mean I can then access any of the JSON properties without having to add them to my codebase somewhere?

{
    "location": {
        "name": "London",
        "region": "City of London, Greater London",
        "country": "United Kingdom",
        "lat": 51.52,
        "lon": -0.11,
        "tz_id": "Europe/London",
        "localtime_epoch": 1695322219,
        "localtime": "2023-09-21 19:50"
    },


This is the first part of the "response body", and I imagine I do not need to add this to my code, I can just simply access the location.name in my code and it'll appear?
Was this page helpful?