Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Calculate dates dynamically in URL: REST

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 21 2020 at 07:20 UTC

Hi,


I have a requirement where I need to pass some dates in my filter while importing user data from SuccessFactors. I came across an example in the SuccessFactors documentation provided. But these dates are all hardcoded.

https://<url>?$select=username,empId,firstName,lastName,custom01,custom13,email&$filter=status+in+'a...",


Is it possible to pass the dates as dynamic attributes like fromDate=current date? If yes, please let me know the format to do so.

I tried using ${(new Date()).format('yyyy-MM-dd')} but it gives me a responseStatusCode:: null.


Any help would be greatly appreciated.


This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.
3 REPLIES 3

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 28 2020 at 14:27 UTC

Hi Arushi,


Yes, it is possible to pass the date as a dynamic attribute. Please try with the below sample URL format


Sample URL format: https://<url>?%24format=json&%24filter=status%20in%20%27t%27,%27f%27&fromDate=${(new Date()).format('yyyy-MM-dd')}



Thank you

Vedanth B.K



This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 5 2022 at 13:23 UTC

Hi Vedanth,

I tried this but Im getting an error ( it doesnt seem to be replacing the date) :


2022-01-05 13:21:51,655 [quartzScheduler_Worker-2] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://api8.successfactors.com/odata/v2/User('010304')?fromDate=${(new Date()).format('yyyy-MM-dd)}&paging=cursor&$filter=empInfo/jobInfoNav/company%20ne%20%27BEA%27&$expand=empInfo/personNav/personalInfoNav/customString3Nav/picklistLabels,empInfo/personNav/emailNav/emailTypeNav/picklistLabels,empInfo/jobInfoNav/locationNav/addressNavDEFLT,empInfo/jobInfoNav/locationNav/customString5Nav,externalCodeOfcust_EEIntegration_noneffNav,empInfo/jobInfoNav/costCenterNav,empInfo/jobInfoNav/departmentNav,empInfo/jobInfoNav/divisionNav,empInfo/jobInfoNav/employeeClassNav,empInfo/jobInfoNav/employeeTypeNav,empInfo/personNav/employmentNav,empInfo/jobInfoNav/regularTempNav,empInfo/jobInfoNav/emplStatusNav,empInfo/personNav/personEmpTerminationInfoNav,empInfo/jobInfoNav/customString12Nav/picklistLabels,empInfo/jobInfoNav/companyNav,empInfo/personNav/homeAddressNavDEFLT,empInfo/jobInfoNav/eventNav/picklistLabels,empInfo/jobInfoNav/eventReasonNav with httpParams - null

2022-01-05 13:21:51,655 [quartzScheduler_Worker-2] DEBUG services.HttpClientUtilityService - isFipsEnabled = false

2022-01-05 13:21:51,655 [quartzScheduler_Worker-2] DEBUG services.HttpClientUtilityService - getHttpClient - sslParams : null

2022-01-05 13:21:51,655 [quartzScheduler_Worker-2] DEBUG services.HttpClientUtilityService - getHttpClient - proxyParams : null

2022-01-05 13:21:51,655 [quartzScheduler_Worker-2] DEBUG services.HttpClientUtilityService - getHttpClient - sslSocketFactory : null

2022-01-05 13:21:51,659 [quartzScheduler_Worker-2] DEBUG services.HttpClientUtilityService - getHttpClient - HttpClientBuilder.create().build() called.

2022-01-05 13:21:51,659 [quartzScheduler_Worker-2] DEBUG rest.RestUtilService - Got showLogs = true

2022-01-05 13:21:51,660 [quartzScheduler_Worker-2] DEBUG rest.RestProvisioningService - Got Webservice API Response: [error:Error Illegal character in query at index 66: https://api8.successfactors.com/odata/v2/User('010304')?fromDate=${(new Date()).format('yyyy-MM-dd)}&paging=cursor&$filter=empInfo/jobInfoNav/company%20ne%20%27BEA%27&$expand=empInfo/personNav/personalInfoNav/customString3Nav/picklistLabels,empInfo/personNav/emailNav/emailTypeNav/picklistLabels,empInfo/jobInfoNav/locationNav/addressNavDEFLT,empInfo/jobInfoNav/locationNav/customString5Nav,externalCodeOfcust_EEIntegration_noneffNav,empInfo/jobInfoNav/costCenterNav,empInfo/jobInfoNav/departmentNav,empInfo/jobInfoNav/divisionNav,empInfo/jobInfoNav/employeeClassNav,empInfo/jobInfoNav/employeeTypeNav,empInfo/personNav/employmentNav,empInfo/jobInfoNav/regularTempNav,empInfo/jobInfoNav/emplStatusNav,empInfo/personNav/personEmpTerminationInfoNav,empInfo/jobInfoNav/customString12Nav/picklistLabels,empInfo/jobInfoNav/companyNav,empInfo/personNav/homeAddressNavDEFLT,empInfo/jobInfoNav/eventNav/picklistLabels,empInfo/jobInfoNav/eventReasonNav]

2022-01-05 13:21:51,660 [quartzScheduler_Worker-2] DEBUG rest.RestProvisioningService - pullObjectsByRest - responseStatusCode ::null

2022-01-05 13:21:51,660 [quartzScheduler_Worker-2] DEBUG rest.RestUtilService - Got showLogs = true

2022-01-05 13:21:51,660 [quartzScheduler_Worker-2] DEBUG rest.RestProvisioningService - Got null response statusCode with erroMsg - null

2022-01-05 13:21:51,660 [quartzScheduler_Worker-2] ERROR rest.RestProvisioningService - Exception in getting response in pullObjectsByRest :

java.lang.Exception: NullResponseFromTarget

 at com.saviynt.provisoning.rest.RestProvisioningService.pullObjectsByRest(RestProvisioningService.groovy:4200)


This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 5 2022 at 13:57 UTC

Resolved. Figured it out. 

Resolution: If you have a $ in your URL, Saviynt tries to replace that and fails and hence it doesnt replace any ${} code. To fix, replace $ with %24 (URLEncoded value for $ ) . Replace all $ other than the ${new Date....} 


This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.