Table of Contents

get object count () > () > () > ()

Description

The block reports the object count of the JSON object from the body.

Example

In this example, we will understand how to use HTTP requests to get weather data from OpenWeatherMap API.

In this example, we will understand how to use HTTP requests to get weather data from OpenWeatherMap API.

OpenWeatherMap Account

Create the account with the following method:

  1. Click on Create an Account on the website: https://openweathermap.org/
  2. Fill in the signup details.
  3. Click on Create Account.
  4. Fill the in the details about usage.
  5. Go to API and copy the API for further usage.

API Request

The following is the method provided by OpenWeatherMaps for fetching the weather data using the lat and longitude of the location.

On making the HTTP Request, we get the following data:

{
    "coord": {
        "lon": 77.4977,
        "lat": 27.2046
    },
    "weather": [
        {
            "id": 800,
            "main": "Clear",
            "description": "clear sky",
            "icon": "01d"
        }
    ],
    "base": "stations",
    "main": {
        "temp": 304.66,
        "feels_like": 303.14,
        "temp_min": 304.66,
        "temp_max": 304.66,
        "pressure": 1012,
        "humidity": 27,
        "sea_level": 1012,
        "grnd_level": 992
    },
    "visibility": 10000,
    "wind": {
        "speed": 1.09,
        "deg": 3,
        "gust": 1.17
    },
    "clouds": {
        "all": 0
    },
    "dt": 1666781571,
    "sys": {
        "country": "IN",
        "sunrise": 1666745753,
        "sunset": 1666786313
    },
    "timezone": 19800,
    "id": 1276128,
    "name": "Bharatpur",
    "cod": 200
}

The data is in JSON format, which we can use in PictoBlox.

PictoBlox Script

The following script makes the HTTP request and makes the Tobi say the temperature of the location.

Output

Read More
All articles loaded
No more articles to load