cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to call workflow using DT API and how to pass workflow input parameters in that API

heramb_sawant
Organizer

Hi All,
I have workflow having task  of SRG validation and this task needs input as test timeframe to evaluate srg.

Howe we can call this workflow using dynatrace API and how we can pass SRG task input from API??

Regards,
Heramb Sawant

5 REPLIES 5

heramb_sawant
Organizer

Please help me to on this issue.

jaume_reverte
Dynatrace Advisor
Dynatrace Advisor

Hello! 

You can make use of the API call /workflows/{id}/run to trigger the execution of a particular workflow. And then in the request body you can send some information. For example: 

{
  "input": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "params": {
    "additionalProp1": "string",
    "additionalProp2": "string",
    "additionalProp3": "string"
  },
  "uniqueQualifier": "string"
}

This information is then available for ypu to use in the workflow execution time. 

For executing this API call the Required scope: automation:workflows:run is needed for the token. 

Best 

Hope you a good monitoring!
Jaume Reverte

Could you please tell me how to capture/receive these input parameters in workflow task.

Regards,
Heramb 

Also If I add above given parameters in the api body as it is. in the response I get workflow  status success but workflow do not triggered and  If I  just remove the above given input  parameters , API works fine workflow status is Running.

What could be the reason here ??

 

Regards,
Heramb sawant

 

You might be able to get that information from the execution log with a js block:

https://developer.dynatrace.com/reference/sdks/client-automation/#getexecutionlog

import { executionsClient } from "@dynatrace-sdk/client-automation";

const data = await executionsClient.getExecutionLog({
  id: "...",
});


An alternative to send the values you want is to change the trigger to a bizevent and send all the information you need in that bizevent:
https://docs.dynatrace.com/docs/shortlink/ba-api-ingest

Eric Yu | LATAM ACE Consultant

Featured Posts