Spencer S. - Technical Writer
View current weather data from the OpenWeather REST API in the Postman app

Introduction

An example use case for the OpenWeather REST API is:
You're creating a website to display today's weather.
 
This article explains how to view the JSON for the weather data, including: 

View your API key

Note: After you create your API key, you will need to wait 1-3 hours for the key to activate.
  1. Go to: https://openweathermap.org
  2. Scroll down to the page's footer. 
  3. Click on "Subscribe for free". Then complete the form.
  4. Open a new tab in your browser. Then open your email provider's app.
  5. Log into your account. Then open the email sent by OpenWeather.
  6. Click the button: "Verify your email".
    In your browser, you will see a new browser tab appear displaying the OpenWeather app.
  7. In your browser, close the previous browser tab displaying the OpenWeather app.
  8. (Optional) Log out of your email account. Then close the browser tab.
  9. On the OpenWeather app, click the sub-heading: "API Keys".
    You will see your API key displayed in a table.

Input your API key

  1. Go to: https://www.postman.com
  2. In the top-right corner, click: "Sign-up for free". Then complete the form.
  3. In the app's header, click "Workspaces" > "My workspace". Then click the "+" button in the subheader to open a new tab.
  4. In the OpenWeather app, click the "API" button in header.
  5. Under the heading, "Current Weather Data", click the button: "API doc".
  6. Under the "API call" heading, highlight-then-copy the beginning section of the URL.
    https://api.openweathermap.org/data/2.5/weather
  7. In the Postman app, paste the URL to the right of the "GET" button.
    Note: If the API key isn't activated yet, you will receive an error message in later steps.
  8. In the OpenWeather app, look under the "Parameters" heading to view which are required:
    • lat, lon [geographic coordinates: latitude and longitude]
    • appid [your API key]
    Note: For this example, we use the approximate coordinates for Toronto: "45, -80".
  9. In the top-right corner of the page, click on your username > "My API keys".
  10. Highlight-then-copy the API key.
  11. In the Postman app, you will see the subheading: "Parameters".
    1. In the first field on the first row, type-in: "lat". In the second field type-in: "45".
    2. In the first field on the second row, type-in: "lon". In the second field type-in: "-80".
    3. In the first field on the third row, type-in: "appid". In the second field, paste your API key.
     

View the JSON data

  1. Click the blue "Send" button.
  2. In the field at the bottom of the page, you will see the results formatted in JSON. For example:
    {
        "coord": {
            "lon": -80,
            "lat": 45
        },
        "weather": [
            {
                "id": 804,
                "main": "Clouds",
                "description": "overcast clouds",
                "icon": "04d"
            }
        ],
        "base": "stations",
        "main": {
            "temp": 293.89,
            "feels_like": 293.95,
            "temp_min": 293.89,
            "temp_max": 293.89,
            "pressure": 1015,
            "humidity": 74,
            "sea_level": 1015,
            "grnd_level": 994
        },
        "visibility": 10000,
        "wind": {
            "speed": 4.21,
            "deg": 283,
            "gust": 4.81
        },
        "clouds": {
            "all": 91
        },
        "dt": 1657735238,
        "sys": {
            "country": "CA",
            "sunrise": 1657705540,
            "sunset": 1657760724
        },
        "timezone": -14400,
        "id": 6137276,
        "name": "Sahanatien",
        "cod": 200
    }
  3. In the data, you can see the:
    • Description is: overcast clouds.
    • Temperature is: 293.89 Kelvin.