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

Saviynt API - Job Trigger with Advanced Query (SQL)

SowmithriV
Regular Contributor
Regular Contributor

How to use the Job Trigger API with Advanced query? The Saviynt API doesn't talk about it but is there a way we can run particular tasks like how we do from the UI?

To put it simply, how to do the below from the API

SowmithriV_1-1708100344585.png

 

 

13 REPLIES 13

AmitM
Valued Contributor
Valued Contributor

AFAIK , not possible

Thanks,

Amit

jsatish
Regular Contributor II
Regular Contributor II

@SowmithriV  - Yes this is possible, try below 
API Call: {{url}}/ECM/{{path}}/runJobTrigger

Request Body:

 

{
    "jobgroup""utility",
    "triggername""Test_Provisioning_5",
    "jobname""WSRETRYJOB",
    "createJobIfDoesNotExist""false",
    "valueMap": {
        "advquery""and at.taskkey in (1,2,3)"
    }
}

SowmithriV
Regular Contributor
Regular Contributor

hi @jsatish, I did try this and looks like it doesn't consider the advquery in the above JSON Body. It seems to process all the requests pending in that endpoint. 

jsatish
Regular Contributor II
Regular Contributor II

@SowmithriV - Is advanced query updated, when you edit the job. ?

SowmithriV
Regular Contributor
Regular Contributor

@jsatish, There is nothing updated in the job. I want to update the advance query via the API. 
Let me give you a context. We have Freshservice integration to look for the task number from the pending task(which they are able to) and provision that particular task by running the job via API too. 

jsatish
Regular Contributor II
Regular Contributor II

@SowmithriV - This is what i have used today, created the job and executed it manually. Everything worked fine. 

createUpdateTrigger

[
   {
      "triggers":[
         {
            "valueMap":{"advquery": "and at.taskkey in (1,2,3,4)"},
           "triggername": "Test_Provisioning_5",
            "group": "utility",
            "jobname": "WSRetryJob",
            "jobgroup": "utility",
            "cronexpression": "0 33 14 * * ? 2060"
         }
      ]
   }
]

  • Do you see Job details updated ?
  • Do you updated taskkey in logs getting picked ?

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

Job is not update with the taskkey and hence there is no trace in the logs @rushikeshvartak 
@jsatish , lemme try to see if the am able to update the job without having to create it. 

Use below API 

rushikeshvartak_0-1714708602161.png

{{URL}}/ECM/{{path}}/createUpdateTrigger

 

rushikeshvartak_1-1714708613024.png

curl --location "https://rushi-dev.saviyntcloud.com/ECM/api/v5/createUpdateTrigger" --header "Authorization: Bearer ey" --header "Content-Type: application/json" --header "Cookie: CCSRF-TOKEN=5a69f1c0-a517-4d82-a726-2d7bc90090e4; INGRESSCOOKIE=1714533700.461.195.179429|0f4091fceac04271d9e9e5a60a3d3e8f; JSESSIONID=D90EEF8DEBD35EB6FAC2AC5457E6095C; access_token=eyJ; token_type=Bearer; user_name=137658" --data "[
{
\"triggers\":[
{
\"valueMap\":{\"advquery\": \"and at.taskkey in (1,2,3,4)\"},
\"triggername\": \"Prov_Dev\",
\"group\": \"utility\",
\"jobname\": \"WSRetryJob\",
\"jobgroup\": \"utility\",
\"cronexpression\": \"0 33 14 * * ? 2060\"
}
]
}
]"

 


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

@rushikeshvartak @jsatish , I did try to update the Advance Query using Create and Update Trigger and when I checked the UI - Job Control, the Adv Query was updated. When I tried to run the Trigger, it again provisioned all the tasks in that endpoint. It did not process just the two tasks that I intended. 

Its looks like your version issue i have validated in v24.4 Upgrade the version and validate 


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

SowmithriV
Regular Contributor
Regular Contributor

it's not ideal to create the job for each task right? Can we have the same adv query set up in the run "Run Job Trigger"?
Also will Create and Update Trigger, create a job and update it or can it only do Update on the job?

jsatish
Regular Contributor II
Regular Contributor II

If the job already exist, it just updates the existing trigger. If it doesn't exists, it will create a new one.
I will test the runTrigger and confirm.