createWorkflow
A Graze API POST request that creates a new workflow at the end of a Workflow Engine Moolet sequence. The new workflow is automatically active. To move it, use reorderWorkflows.
Back to Graze API EndPoint Reference.
Request arguments
Endpoint createWorkflow
takes the following request arguments:
Name | Type | Required | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| String | Yes | A valid | ||||||||||||||||||||||||||||||||
| String | Yes | Name of the Workflow Engine Moolet that the new workflow belongs to. | ||||||||||||||||||||||||||||||||
| String | Yes | Name of the new workflow. Must be unique. | ||||||||||||||||||||||||||||||||
| String | No | Description of the new workflow. | ||||||||||||||||||||||||||||||||
| JSON Object | No | An SQL-like filter to determine which events, alerts or Situations can enter the workflow. Leave empty for the workflow to accept all events, alerts or Situations. See Filter Search Data for more information on creating SQL-like filters. | ||||||||||||||||||||||||||||||||
| JSON Object | No | An SQL-like filter to intake any additional events, alerts or Situations from the database. See Filter Search Data for more information on creating SQL-like filters. | ||||||||||||||||||||||||||||||||
| Integer | No | A relative time window (in seconds) for further restricting the alerts/Situations in the | ||||||||||||||||||||||||||||||||
| Boolean | Yes | If enabled, events, alerts, and Situations only pass through actions on the first time they enter this workflow. | ||||||||||||||||||||||||||||||||
| JSON List | Yes | List of properties relating to each operation:
|
Response
Endpoint createWorkflow
returns the following response:
Successful requests return a JSON object containing the following:
Type | Description |
---|---|
JSON Object | A JSON object containing the ID of the newly created workflow. |
Examples
The following examples demonstrate typical use of endpoint createWorkflow
:
Request example
Example cURL request to create a new workflow with a setCustomInfoValue action:
curl -X POST -u graze:graze -k \ -v "https://localhost/graze/v1/createWorkflow" \ -H "Content-Type: application/json; charset=UTF-8" \ --data ' { "first_match_only": false, "operations": [ { "duration": 0, "reset": false, "type": "delay" }, { "operation_name": "set support team value in custom info", "function_name": "setCustomInfoValue", "forwarding_behavior": "always forward", "function_args": { "value": "NOC", "key": "support_team" }, "type": "action" } ], "moolet_name": "Alert Workflows", "workflow_name": "Alert Workflow Example", "entry_filter": "state = 9", "active": true, "description": "Alert Workflow API Example", "sweep_up_filter": "((agent = \"Test\") AND (significance = 0)) OR (severity = 0)" }'
Response example
Example response returning the new workflow ID:
{"id":12}