Missing value for key "alerts"


I try a challenge from the learn-clojurescript book where I have to display a 4 hour weather forecast

So I did

(defn get-forecast! []
  (let [postal-code (:postal-code @app-state)]
    (ajax/GET "http://api.openweathermap.org/data/2.5/onecall"
      {:params {"q" postal-code
                "units" "metric" ;; alternatively, use "metric"
                "appid" "fa9930ab5e2a87f9770d1c90d68f9da1"
                "exclude" "minutely", "current", "daily", "alerts" }
       :handler handle-response})))

but now I get the above error.

How to solve it ?

from what I can understand you are to put the values of the “exclude” key in a list as stated on the openweathermap website (By using this parameter you can exclude some parts of the weather data from the API response. It should be a comma-delimited list (without spaces)).
Since :params is a map it expects every key to have a value next to it.

sorry, I think I still do not understand what you mean.
It is correct that I try to add things I want to exclude.

So since maps are key-value pairs, what you have done is give the “exclude” key the value of “minutely” instead of a list containing the parameters you want to exclude.
According to the website the value of exclude should be a “comma delimited list”


I was looking at this example

https://api.openweathermap.org/data/2.5/onecall?lat=33.44&lon=-94.04&exclude=hourly,daily&appid={API key}

and that is why I did

"exclude" "minutely","current","daily","alerts"

as far as I see it I have a comma delimeted list but the clojure compiler is not happy about that

That’s because the compiler is pairing “exclude” with “minutely”, “current” with “daily”, and “alerts” with nothing.
I feel you should try doing this instead
“exclude” [“minutely”,“current”,“daily”,“alerts”]


That seems to work.
I hope I can now see what the respons is and take out the values I need