I have a JSON file that contains a query I am using to pull audit history data from Oracle. I need to be able to automate changing the fromDate and toDate parameters daily. I was thinking to create a powershell script and use: Get-Date -format "yyyy-MM-dd" as a variable, but not sure this is the best approach? My JSON file (Oracle.json) looks like this:
{
"fromDate": "2019-04-18",
"toDate": "2019-04-18",
"product": "OPSS",
"eventType": "RoleMembershipAdd"
}
I am then using curl to make the POST request and output the data to flat file:
curl.exe -i --user username:password -X POST -H "Content-Type: application/json" -d "@C:\Oracle.json" hxxps://someurl.com/fscmRestApi/fndAuditRESTService/audittrail/getaudithistory >> C:\Oracle.txt
What would be the best way to make the dates dynamic so I can have the script run daily and pull from that day without having to change the dates manually?