HTTP GET query parameters
-
Hi All,
I want to build a weather station and use a weather API to get forecast details. I am using a service where the HTTP GET URL is the following:
https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/Budapest/today?unitGroup=metric&elements=tempmax%2Ctempmin%2Cprecipprob%2Cconditions%2Cicon&include=days&key=API_KEY&contentType=json
When I paste this into the HTTP request URL, the part after the ? gets truncated. I could not find an example how it needs to be added. It is not header information, nor Data.How to you add the query parameters?
Thanks,
Csongor -
@csongor-varga: Yup, I'm experiencing the same issue with openweathermap.org. My HTTP GET URL gets stripped of all the parameters following the question mark. Modifying the Python code works, but there's no switching back to Blockly anymore.
-
I've got it. Replace the existing URL text box with an unescaped text box and type/paste the URL. There should be no more truncating at the question mark.
-
@epollari Nice work in sorting it out.
-
@epollari Thanks a lot. Even though I am watching my own thread, I am not getting a notification on comments. Good that I checked :)
Can I ask you to also check my next issue?
So my web service returns a json like this:
{"queryCost":1,"latitude":47.4997,"longitude":19.0551,"resolvedAddress":"Budapest, Magyarország","address":"Budapest","timezone":"Europe/Budapest","tzoffset":2.0,"days":[{"tempmax":26.0,"tempmin":10.0,"precipprob":0.0,"conditions":"Clear","icon":"clear-day"}]}
So far I am just trying to get the various pieces out of this json, but you can see above how you get an element from an array. And finally it works :)