Workflow exec automation endpoint

Does anyone have an example of the initial POST request to trigger a workflow that includes setting the recordIDs, Module handle or ID, and the namespace handle or ID?

I’ve look at the request via the Chrome developer tools to see what the payload is when I run a workflow manually via the UI and it includes all of the data you get after you select “Load and configure” and I’m guessing not everything is needed, although I could be wrong.

I’ve tried several variations on the request below:

curl --location ‘http://cortezaURL/api/automation/workflows/340151234567891619/exec
–header ‘Content-Type: application/json’
–header ‘Authorization: Bearer myJWTtoken’
–data ‘{
“stepID”: “4”,
“input”: “{"record": "340159991236743507","module": "my_module_handle","namespace": "my_namespace_handle"}”,
“trace”: true,
“wait”: true,
“async”: true
}’

I keep getting a parse error that I’m guessing is from the input.

{
“error”: {
“message”: “error parsing http request body: json: cannot unmarshal string into Go struct field WorkflowExec.Input of type map[string]*expr.typedValueWrap”
}
}

Finally got it to work.

An example POST request to trigger a workflow is below.

curl --location ‘http://myCortezaURL/api/automation/workflows/340123414569789619/exec
–header ‘Content-Type: application/json’
–header ‘Authorization: Bearer myJWT’
–data-raw ‘{
“stepID”: “4”,
“input”: {
“namespace”: {
@value”: {
“namespaceID”: “330123456789012451”,
“slug”: “NSSLUG”
},
@type”: “ComposeNamespace”
},
“module”: {
@value”: {
“moduleID”: “312345678901265987”,
“handle”: “module_handle”,
“namespaceID”: “330123456789012451”
},
@type”: “ComposeModule”
},
“record”: {
@value”: {
“recordID”: “312345632739778907”,
“moduleID”: “312345678901265987”,
“values”: [
{
“name”: “FieldA”,
“value”: “abc”
}
],
“namespaceID”: “330123456789012451”,
“resourceType”: “compose:record”
},
@type”: “ComposeRecord”
},
“oldRecord”: {
@value”: {
“recordID”: “312345632739778907”,
“moduleID”: “312345678901265987”,
“values”: [
{
“name”: “FieldA”,
“value”: “def”
}
],
“namespaceID”: “330123456789012451”,
“resourceType”: “compose:record”
},
@type”: “ComposeRecord”
},
“recordValueErrors”: {
@value”: {},
@type”: “Any”
},
“selected”: {
@value”: {},
@type”: “Any”
}
},
“trace”: true,
“wait”: false,
“async”: true
}’