Search code examples
weather-api

Using Weather API, can I omit the "hour" parameter from the response?


I am trying to send requests to the Weather API for forecast data.

And in the response inside

response.forecast.forecastday[index]

there's a field called hour which is HUGE, it's an array with detailed forecast info for every hour, multiply by 24 for each day, multiply by the amount of days for my forecast.

This field turns the response to by 50kb, without it I can reduce the response to be about 5kb.

Is there a way to omit it?

Here's an example of the request I am sending:

https://api.weatherapi.com/v1/forecast.json?key={{WeatherApiKey}}&q=London&days=14

Solution

  • After reading the documentation, i realized that you have an optional parameter in the request which called "hour" Optional hour

    It is a little bit hack, but i checked it out and its works - If you set the parameter hour to be "25" It will gives you an empty list

    example for the request:

    http://api.weatherapi.com/v1/forecast.json?key=key&q=London&days=14&hour=25