MockWeatherAPI provides essential weather data, including both short-term and long-term forecasts. Use this API to retrieve weather data that includes daily, minutely, and hourly forecasts.

Making the API Call

Make API calls to retrieve weather information using the below MockWeatherAPI endpoint.

<https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude={part}&appid=>{API key}

To make the API call using Postman:

  1. Open Postman workspace.
  2. Select the GET method.
  3. Enter the MockWeatherAPI endpoint as the URL and replace the {} with the parameters as required.
  4. Click Send.

Alternatively, use the following curl command in the command line to make the API call.

curl -X GET <https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude={part}&appid=>{API key}

Note: Replace the {} with the parameter values as applicable.

Example Response

{
   "lat":22.5744,
   "lon":88.3629:,
   "timezone":"India/Kolkata",
   "current":{
      "dt":1684929490,
      "sunrise":1684926645,
      "sunset":1684977332,
      "temp":292.55,
      "feels_like":292.87,
      "pressure":1014,
      "humidity":89,
      "weather":[
         {
            "id":803,
            "main":"Clouds",
            "description":"broken clouds",
         }
      ]
   }
}   

Query Parameters

Parameters Requirements Data Type Description
lat required float Latitude of the location. The latitude range is (-90, 90).
lon required float Longitude of the location. The longitude range is (-180, 180).
appid required string The unique API Key for an user. Find yours within the profile page by clicking on the API Key tab.
exclude optional string Parameter to exclude some parts of the weather data from the API response. It should be a comma delimited list.

Available values are current, minutely, hourly, and daily. | | units | optional | string | The units for measurement. Available unit types are standard, metric, and imperial. >Note: If you do not specify the units in the endpoint, standard units will be applicable by default. | | lang | optional | string | Parameter to get the output in your language |

Response Parameters

Parameters Data Type Description
timezone string The timezone of the requested location.
current Current weather data given as API response.
current.dt int Current time as UNIX timestamp, UTC.
current.sunrise int Sunrise time as UNIX timestamp, UTC.
current.sunset int Sunset time as UNIX timestamp, UTC.
current.temp int Temperature at the moment.
Units to Measure: Default - Kelvin, Metric - Celsius, and Imperial - Fahrenheit.
current.feels_like int Temperature perceived by the human body.
Units to Measure: Default - Kelvin, Metric - Celsius, and Imperial - Fahrenheit.
current.pressure int Atmospheric pressure at sea-level measured in hPa by default.
current.humidity int Atmospheric humidity in the air measured in %.
current.weather Overall weather information as part of the API response.
current.weather.id int Unique id for current weather condition.
current.weather.main string Group of weather parameters (Rain, Cloud, Sun, etc.)
current.weather.description string Detailed description on the current weather condition.

Errors

Error 404