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

Creating a Job Trigger via API

heyrohan
New Contributor II
New Contributor II

Hello World,

So I was trying to create a newly fresh Job trigger in "Job Control Panel" and running it through Saviynt API,
But the API is not creating a Job "properly", by properly I meant,
Through API it is creating a Job but it is not able to fetch "connection" details even though I have given it.

Maybe either I am giving it the incorrect Request body or maybe saviynt is not able to fetch the "connection" details.
I am using Saviynt v23.5 and this documentation for API : 
https://documenter.getpostman.com/view/20697337/2s93eZyBVM#intro

these are the list of API that I tried to create a Job :

  • Create and Update Trigger (/createUpdateTriggers)
  • Run Job Trigger (/runJobTrigger)
  • createTrigger (/createTriggers)

Till now only "/runJobTrigger" has been the working one, other APIs are either giving "401 Unauthorized" or "405 Method not allowed" error even though I have given correct method and bearer token.

This is the body that I am giving in RequestBody for "/runJobTrigger" :

 

 

 {  
            "valueMap":{  
               "CONNECTION":"connection_name",
               "connectiontype":"DB",
               "connectionid":35
            },
            "createJobIfDoesNotExist": "true",
            "name":"test2",
            "group":"GRAILS_JOBS",
            "jobName":"AccountsImportFullJob",
            "jobGroup":"DATABASE",
            "cronExp":"0 15 10 * * ? 2099"
}

 

 

and output is : 

 

 

{
    "msg": "Starting Job",
    "errorCode": "0",
    "timestamp": "2024-04-18 11:11:24"
}

 

 

On UI this is the output : 

heyrohan_0-1713438814692.png

and the logs are these : 

 

 

{"log":"2024-04-18 11:24:29,212 [quartzScheduler_Worker-8] DEBUG jobs.AccountsImportFullJob - AccountsImportFullJob.execute - map : [org.grails.plugins.quartz.grailsJobName:AccountsImportFullJob, tabDetail:null, fireInstanceId:NON_CLUSTERED1713024973859, jobnamelabel:Accounts Import (Complete) from Database (AccountsImportFullJob), TABLENAME:ACCOUNTS, lastJobId:23894, updateUser:L200Trainee, jobtriggername:test2, fullorincremental:full]\n","stream":"stdout","time":"2024-04-18T11:24:29.212600507Z"}

 

 

Just to confirm if I am passing the correct Json RequestBody and correct parameters,
I tested it in 2 ways :

  1. Checking the payload in Developer tool while creating and Saving a Job through Saviynt UI.
  2. By checking the logs of successful import of a Job that was created through Saviynt UI.

and the outcomes are :
Payload :-

heyrohan_1-1713440050302.png

Logs of a Successful Import job :-

 

 

{"log":"2024-04-18 11:18:10,072 [quartzScheduler_Worker-10] DEBUG jobs.AccountsImportFullJob - AccountsImportFullJob.execute - map : [org.grails.plugins.quartz.grailsJobName:AccountsImportFullJob, tabDetail:cronexpression::0 15 10 * * ? 2099, CONNECTION:connection_name, fireInstanceId:NON_CLUSTERED1713024973858, cronexpression:0 15 10 * * ? 2099, securitySystemKeysInTrigger:, jobnamelabel:Accounts Import (Complete) from Database (AccountsImportFullJob), TABLENAME:ACCOUNTS, lastJobId:23893, updateUser:L200Trainee, jobtriggername:DBImport, fullorincremental:full]\n","stream":"stdout","time":"2024-04-18T11:18:10.072389763Z"}

 

 

Please tell me if I need to change/Add any parameter in API RequestBody or is this a Saviynt Bug or Saviynt Does not allow us to create a Job using API ? 

2 REPLIES 2

rushikeshvartak
All-Star
All-Star

I have created using api and it works as expected 

rushikeshvartak_0-1713495525231.pngrushikeshvartak_1-1713495536909.png

[
{
"triggers":[

{
"valueMap":{
"CONNECTION":"Saviynt",
"connectiontype":"DB",
"connectionid":6
},
"name": "rushiapi1",
"group": "GRAILS_JOBS",
"jobName": "AccountsImportFullJob",
"jobGroup": "DATABASE",
"cronExp": "0 33 14 * * ? 2060"
}
]
}
]a


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Thank @rushikeshvartak , It worked, actually I was missing the authorization paramter to give in headers, I know such a silly mistake!