Internet data (JSON)
Advanced · Ask an API for a city's temperature and show it on the stage.
Interactive tutorial: the editor checks each step by itself.
- Add the "Web and JSON" extension.
- Choose a sprite and drag "when flag clicked".
- Snap "GET request to … named request1 and wait" below (the weather address is already filled in).
- Snap "say" (Looks) and put inside it "value current.temperature_2m of (response data of request1)".
- Check: the second slot of "value" must have "response data of request1".
- Click the flag. The first time, allow access to the site. What's the temperature?
- Challenge: use "when request request1 fails" to warn when there's no internet. (challenge)