Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
SJeshwani1618330394
Contributor
Contributor

How to set dynamic variable to the REST API to get current time

Hi all,

I have an API that contains query parameters for startdate. I want to run this job at the end of the month every time. I don't want to manually pass the value in the URL to set the current date. How to do this?

The URL image is attached where it can be seen that I am giving the date and time in STARTDATE='2021-06-30 23:59:59'

First, I want to know how to set context variables to just store STARTDATE. I can store the whole URL in one variable but I just want to store STARTDATE.

The job picture I have also attached.

I don't want to hardcode this flow or else manually I need to change the date every month which does not sound good if I want to schedule this job for every month at a particular date.

It would be great if someone can help me with this.

Regards,

Sheetal

Labels (2)
1 Reply
Anonymous
Not applicable

What about the url constructing with java code:

"where=STARTDATE>='" + context.startdate + "'&return..."

Or you can use string replacement:

"where=STARTDATE>='{context.startdate}'&return... ".replace("{context.startdate}", context.startdate)

(I have shortened the URL)