Dynamic startdate in REST URL

sris
New Contributor III
New Contributor III

Hello,

We need to configure a REST connector with URL for startdate as systemdate or systemdate-1. We are trying below

https://<URL>?StartDate=${String pattern = 'mm/dd/yyyy';java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat(pattern);Date d = new Date();return simpleDateFormat.format(d)}

The error says failed URL.

We tried the URL below

"url": "<URL>?ActiveFlag=Y&StartDate=${new Date().minus(1).format('yyyy-MM-dd')}&Filter_str=SOURCE_NAME=ABC:JOB_STATUS=Active

Seeing responsecode 401

Can someone please advise what change it needs?

Thanks in advance

 

Below URL Works

"url": "<URL>&StartDate=${new Date().format('yyyy-MM-dd')}&Filter_str=SOURCE_NAME=ABC:JOB_STATUS=Active

[This post has been edited by a Moderator to merge two posts.]

 

1 REPLY 1

Hemanath
Saviynt Employee
Saviynt Employee

Hi @sris 

Below will decrement the date by one day eg - current date = 24-08-2023 return date will be 08/23/2023

https://<URL>?StartDate=${Calendar cal = Calendar.getInstance();cal.add(Calendar.DATE, -1);return cal.getTime().format('MM/dd/yyyy')}

Thanks,

Hemanath J