Insert variable result into HTTP GET

I have a variable with the date today formatted as I need it using today = formatDate(now(), "YYYY-MM-DD ")

Let’s call the variable $DateToday

I have an API request that I need today’s date (2023-11-08) put in a particular location (bold type below)

api.openweathermap.org/data/3.0/onecall/day_summary?lat=40.1817378&lon=-80.1331118&date=2023-11-08&appid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Is it possible to put $DateToday into my request automatically?

Yes, you can use the +VARIABLE option within an HTTP Action.

Edit: And while it doesn’t apply to this particular input since the format you mentioned is OK to be used directly in a URL, don’t forget that there’s also a urlEncode() expression that can be used as well.

2 Likes

If he wanted to add 1 day to the $DateToday variable and get tomorrow’s date – there’s no path to do that math in the URL is there? I’m doing this today and doing the math in another variable in front of the HTTP post request, just curious if there was a path to do the math in the HTTP action call.

Not a big deal if I have to do the math in a variable prior to the HTTP call.

Yes. See the note about Inline Expressions from the documentation.

1 Like

Great! I had completely missed that previously…