Ask Your Question

how to pass query parameters in http client

asked 2020-07-29 06:50:13 -0500

sivavenna gravatar image

I am using http client to read data from REST API.My rest api url-

query parameters to be passed- per_age, start_date, end_date

the complete api url will be- ?&end_date=?

I want to pass end_date as todays date and start_date as last 20 days

How to pass this parameters ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-07-29 15:11:31 -0500

iamontheinet gravatar image


You can use built-in functions to pass values as query string parameters like so${time:extractStringFromDate(time:now(),'MM-dd-yyyy')}, but there isn't a time diff function unless you convert everything to epoch first and to the math. (The docs link I provided has all the available functions you can use.)

Hope this helps.

Cheers, Dash

edit flag offensive delete link more


thank you for reply@ iamontheinet.I have tried as you suggested it's throwing error, I also tried to define a parameter like start= ${time:extractStringFromDate(time:now(),'MM-dd-yyyy')} and$start but no luck

sivavenna gravatar imagesivavenna ( 2020-08-07 10:47:33 -0500 )edit

Example I have provided in my answer definitely works. Triple check your syntax.

iamontheinet gravatar imageiamontheinet ( 2020-08-07 10:50:13 -0500 )edit

sorry my bad,it worked i had tweak date format as yyyy-MM-dd. for time diff as you said I tried this-${time:dateTimeToMilliseconds(time:now())} giving me epoch time in milliseconds and then convert this epoch to date-${millisecondsToDateTime({time:dateTimeToMilliseconds(time:now())})} giving error

sivavenna gravatar imagesivavenna ( 2020-08-07 13:02:40 -0500 )edit

I have figured it out, it's working as expected. Thank you so much @iamontheinet

sivavenna gravatar imagesivavenna ( 2020-08-07 14:29:23 -0500 )edit

You're welcome! What was it?

iamontheinet gravatar imageiamontheinet ( 2020-08-07 14:30:01 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-07-29 06:50:13 -0500

Seen: 117 times

Last updated: Jul 29