Call workflow using Dynatrace API and pass workflow input parameters

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

Please help me to on this issue.

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

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,<br>Heramb sawant

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

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