This API describes the ways of interacting with Mistral service via HTTP protocol using Representational State Transfer concept (ReST).
Currently this API relies on JSON to represent states of REST resources.
The common HTTP Response Status Codes (https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used.
Application Root provides links to all possible API methods for Mistral. URLs for other resources described below are relative to Application Root.
All API v2 URLs are relative to API v2 root.
Workbook
¶Workbook resource.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"definition": "HERE GOESWORKBOOK DEFINITION IN MISTRAL DSL v2",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "book",
"namespace": "",
"project_id": "a7eb669e9819420ea4bd1453e672c0a7",
"scope": "private",
"tags": [
"large",
"expensive"
],
"updated_at": "1970-01-01T00:00:00.000000"
}
definition
¶Type: | unicode |
---|
workbook definition in Mistral v2 DSL
scope
¶Type: | Enum(private, public) |
---|
‘private’ or ‘public’
name is immutable. tags is a list of values associated with a workbook that a user can use to group workbooks by some criteria (deployment workbooks, Big Data processing workbooks etc.). Note that name and tags get inferred from workbook definition when Mistral service receives a POST request. So they can’t be changed in another way.
Workbooks
¶A collection of Workbooks.
Data samples:
{
"workbooks": [
{
"created_at": "1970-01-01T00:00:00.000000",
"definition": "HERE GOESWORKBOOK DEFINITION IN MISTRAL DSL v2",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "book",
"namespace": "",
"project_id": "a7eb669e9819420ea4bd1453e672c0a7",
"scope": "private",
"tags": [
"large",
"expensive"
],
"updated_at": "1970-01-01T00:00:00.000000"
}
]
}
GET
/v2/workbooks
¶Return a list of workbooks.
Parameters: |
|
---|---|
Return type: |
GET
/v2/workbooks
¶Return the named workbook.
Parameters: |
|
---|---|
Return type: |
POST
/v2/workbooks
¶Create a new workbook.
Parameters: |
|
---|
PUT
/v2/workbooks
¶Update a workbook.
Parameters: |
|
---|
DELETE
/v2/workbooks
¶Delete the named workbook.
Parameters: |
|
---|
Workflow
¶Workflow resource.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"definition": "HERE GOESWORKFLOW DEFINITION IN MISTRAL DSL v2",
"id": "123e4567-e89b-12d3-a456-426655440000",
"input": "param1, param2",
"name": "flow",
"namespace": "",
"project_id": "a7eb669e9819420ea4bd1453e672c0a7",
"scope": "private",
"tags": [
"large",
"expensive"
],
"updated_at": "1970-01-01T00:00:00.000000"
}
definition
¶Type: | unicode |
---|
Workflow definition in Mistral v2 DSL
scope
¶Type: | Enum(private, public) |
---|
‘private’ or ‘public’
name is immutable. tags is a list of values associated with a workflow that a user can use to group workflows by some criteria. Note that name and tags get inferred from workflow definition when Mistral service receives a POST request. So they can’t be changed in another way.
Workflows
¶A collection of workflows.
Data samples:
{
"next": "http://localhost:8989/v2/workflows?sort_keys=id,name&sort_dirs=asc,desc&limit=10&marker=123e4567-e89b-12d3-a456-426655440000",
"workflows": [
{
"created_at": "1970-01-01T00:00:00.000000",
"definition": "HERE GOESWORKFLOW DEFINITION IN MISTRAL DSL v2",
"id": "123e4567-e89b-12d3-a456-426655440000",
"input": "param1, param2",
"name": "flow",
"namespace": "",
"project_id": "a7eb669e9819420ea4bd1453e672c0a7",
"scope": "private",
"tags": [
"large",
"expensive"
],
"updated_at": "1970-01-01T00:00:00.000000"
}
]
}
GET
/v2/workflows
¶Return a list of workflows.
Parameters: |
|
---|---|
Return type: |
GET
/v2/workflows
¶Return the named workflow.
Parameters: |
|
---|---|
Return type: |
POST
/v2/workflows
¶Create a new workflow.
Parameters: |
|
---|
The text is allowed to have definitions of multiple workflows. In such case, they all will be created.
PUT
/v2/workflows
¶Update one or more workflows.
Parameters: |
|
---|
The text is allowed to have definitions of multiple workflows. In such case, they all will be updated.
DELETE
/v2/workflows
¶Delete a workflow.
Parameters: |
|
---|
Action
¶Action resource.
NOTE: name is immutable. Note that name and description get inferred from action definition when Mistral service receives a POST request. So they can’t be changed in another way.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"definition": "HERE GOES ACTION DEFINITION IN MISTRAL DSL v2",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "flow",
"project_id": "a7eb669e9819420ea4bd1453e672c0a7",
"scope": "private",
"tags": [
"large",
"expensive"
],
"updated_at": "1970-01-01T00:00:00.000000"
}
Actions
¶A collection of Actions.
Data samples:
{
"actions": [
{
"created_at": "1970-01-01T00:00:00.000000",
"definition": "HERE GOES ACTION DEFINITION IN MISTRAL DSL v2",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "flow",
"project_id": "a7eb669e9819420ea4bd1453e672c0a7",
"scope": "private",
"tags": [
"large",
"expensive"
],
"updated_at": "1970-01-01T00:00:00.000000"
}
],
"next": "http://localhost:8989/v2/actions?sort_keys=id,name&sort_dirs=asc,desc&limit=10&marker=123e4567-e89b-12d3-a456-426655440000"
}
GET
/v2/actions
¶Return all actions.
Parameters: |
|
---|---|
Return type: |
GET
/v2/actions
¶Return the named action.
Parameters: |
|
---|---|
Return type: |
POST
/v2/actions
¶Create a new action.
PUT
/v2/actions
¶Update one or more actions.
Parameters: |
|
---|
DELETE
/v2/actions
¶Delete the named action.
Parameters: |
|
---|
Execution
¶Execution resource.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"description": "this is the first execution.",
"id": "123e4567-e89b-12d3-a456-426655440000",
"input": "{}",
"output": "{}",
"params": "{\"notify\": [{\"url\": \"http://endpoint/of/webhook\", \"headers\": {\"Content-Type\": \"application/json\", \"X-Auth-Token\": \"123456789\"}, \"type\": \"webhook\"}, {\"topic\": \"failover_queue\", \"host\": \"127.0.0.1\", \"type\": \"queue\", \"port\": 5432, \"backend\": \"rabbitmq\"}], \"env\": {\"k2\": 123, \"k1\": \"abc\"}}",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"state": "SUCCESS",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_id": "123e4567-e89b-12d3-a456-426655441111",
"workflow_name": "flow",
"workflow_namespace": "some_namespace"
}
description
¶Type: | unicode |
---|
description of workflow execution
id
¶Type: | unicode |
---|
execution ID. It is immutable and auto assigned or determined by the API
input
¶Type: | json |
---|
input is a JSON structure containing workflow input values
output
¶Type: | json |
---|
output is a workflow output
params
¶Type: | json |
---|
‘params’ define workflow type specific parameters. Specific parameters are: ‘task_name’ - the name of the target task. Only for reverse workflows. ‘env’ - A string value containing the name of the stored environment object or a dictionary with the environment variables used during workflow execution and accessible as ‘env()’ from within expressions (YAQL or Jinja) defined in the workflow text. ‘evaluate_env’ - If present, controls whether or not Mistral should recursively find and evaluate all expressions (YAQL or Jinja) within the specified environment (via ‘env’ parameter). ‘True’ - evaluate all expressions recursively in the environment structure. ‘False’ - don’t evaluate expressions. ‘True’ by default.
root_execution_id
¶Type: | unicode |
---|
reference to the root execution
source_execution_id
¶Type: | unicode |
---|
reference to a workflow execution id which will signal the api to perform a lookup of a current workflow_execution and create a replica based on that workflow inputs and parameters
state
¶Type: | unicode |
---|
state can be one of: IDLE, RUNNING, SUCCESS, ERROR, PAUSED
state_info
¶Type: | unicode |
---|
an optional state information string
task_execution_id
¶Type: | unicode |
---|
reference to the parent task execution
workflow_id
¶Type: | unicode |
---|
workflow ID
workflow_name
¶Type: | unicode |
---|
workflow name
workflow_namespace
¶Type: | unicode |
---|
Workflow namespace. The workflow namespace is also saved under params and passed to all sub-workflow executions. When looking for the next sub-workflow to run, The correct workflow will be found by name and namespace, where the namespace can be the workflow namespace or the default namespace. Workflows in the same namespace as the top workflow will be given a higher priority.
Executions
¶A collection of Execution resources.
Data samples:
{
"executions": [
{
"created_at": "1970-01-01T00:00:00.000000",
"description": "this is the first execution.",
"id": "123e4567-e89b-12d3-a456-426655440000",
"input": "{}",
"output": "{}",
"params": "{\"notify\": [{\"url\": \"http://endpoint/of/webhook\", \"headers\": {\"Content-Type\": \"application/json\", \"X-Auth-Token\": \"123456789\"}, \"type\": \"webhook\"}, {\"topic\": \"failover_queue\", \"host\": \"127.0.0.1\", \"type\": \"queue\", \"port\": 5432, \"backend\": \"rabbitmq\"}], \"env\": {\"k2\": 123, \"k1\": \"abc\"}}",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"state": "SUCCESS",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_id": "123e4567-e89b-12d3-a456-426655441111",
"workflow_name": "flow",
"workflow_namespace": "some_namespace"
}
],
"next": "http://localhost:8989/v2/executions?sort_keys=id,workflow_name&sort_dirs=asc,desc&limit=10&marker=123e4567-e89b-12d3-a456-426655440000"
}
GET
/v2/executions
¶Return all Executions.
Parameters: |
|
---|---|
Return type: |
GET
/v2/executions
¶Return the specified Execution.
Parameters: |
|
---|---|
Return type: |
POST
/v2/executions
¶Create a new Execution.
Parameters: |
|
---|---|
Return type: |
PUT
/v2/executions
¶Update the specified workflow execution.
Parameters: |
|
---|---|
Return type: |
DELETE
/v2/executions
¶Delete the specified Execution.
Parameters: |
|
---|
When a workflow starts Mistral creates an execution. It in turn consists of a set of tasks. So Task is an instance of a task described in a Workflow that belongs to a particular execution.
Task
¶Task resource.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "task",
"processed": true,
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"published": "{\"key\": \"value\"}",
"reset": true,
"result": "task result",
"runtime_context": "{\"triggered_by\": [{\"event\": \"on-success\", \"task_id\": \"123-123-123\"}]}",
"state": "SUCCESS",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_execution_id": "123e4567-e89b-12d3-a456-426655440000",
"workflow_id": "123e4567-e89b-12d3-a456-426655441111",
"workflow_name": "flow"
}
state
¶Type: | unicode |
---|
state can take one of the following values: IDLE, RUNNING, SUCCESS, ERROR, DELAYED
state_info
¶Type: | unicode |
---|
an optional state information string
Tasks
¶A collection of tasks.
Data samples:
{
"tasks": [
{
"created_at": "1970-01-01T00:00:00.000000",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "task",
"processed": true,
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"published": "{\"key\": \"value\"}",
"reset": true,
"result": "task result",
"runtime_context": "{\"triggered_by\": [{\"event\": \"on-success\", \"task_id\": \"123-123-123\"}]}",
"state": "SUCCESS",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_execution_id": "123e4567-e89b-12d3-a456-426655440000",
"workflow_id": "123e4567-e89b-12d3-a456-426655441111",
"workflow_name": "flow"
}
]
}
GET
/v2/tasks
¶Return all tasks.
Where project_id is the same as the requester or project_id is different but the scope is public.
Parameters: |
|
---|---|
Return type: |
GET
/v2/tasks
¶Return the specified task.
Parameters: |
|
---|---|
Return type: |
PUT
/v2/tasks
¶Update the specified task execution.
Parameters: |
|
---|---|
Return type: |
GET
/v2/executions
¶Return all tasks within the execution.
Where project_id is the same as the requester or project_id is different but the scope is public.
Parameters: |
|
---|---|
Return type: |
When a Task starts Mistral creates a set of Action Executions. So Action Execution is an instance of an action call described in a Workflow Task that belongs to a particular execution.
ActionExecution
¶ActionExecution resource.
Data samples:
{
"accepted": true,
"created_at": "1970-01-01T00:00:00.000000",
"description": "My running action",
"id": "123e4567-e89b-12d3-a456-426655440000",
"input": "{\"first_name\": \"John\", \"last_name\": \"Doe\"}",
"name": "std.echo",
"output": "{\"some_output\": \"Hello, John Doe!\"}",
"params": "{\"save_result\": true, \"run_sync\": false}",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"state": "SUCCESS",
"state_info": "SUCCESS",
"tags": [
"foo",
"fee"
],
"task_execution_id": "343e45623-e89b-12d3-a456-426655440090",
"task_name": "task1",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_name": "flow"
}
ActionExecutions
¶A collection of action_executions.
Data samples:
{
"action_executions": [
{
"accepted": true,
"created_at": "1970-01-01T00:00:00.000000",
"description": "My running action",
"id": "123e4567-e89b-12d3-a456-426655440000",
"input": "{\"first_name\": \"John\", \"last_name\": \"Doe\"}",
"name": "std.echo",
"output": "{\"some_output\": \"Hello, John Doe!\"}",
"params": "{\"save_result\": true, \"run_sync\": false}",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"state": "SUCCESS",
"state_info": "SUCCESS",
"tags": [
"foo",
"fee"
],
"task_execution_id": "343e45623-e89b-12d3-a456-426655440090",
"task_name": "task1",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_name": "flow"
}
]
}
GET
/v2/action_executions
¶Return all tasks within the execution.
Where project_id is the same as the requester or project_id is different but the scope is public.
Parameters: |
|
---|---|
Return type: |
GET
/v2/action_executions
¶Return the specified action_execution.
Parameters: |
|
---|---|
Return type: |
POST
/v2/action_executions
¶Create new action_execution.
Parameters: |
|
---|---|
Return type: |
PUT
/v2/action_executions
¶Update the specified action_execution.
Parameters: |
|
---|---|
Return type: |
DELETE
/v2/action_executions
¶Delete the specified action_execution.
Parameters: |
|
---|
GET
/v2/tasks
¶Return all tasks within the execution.
Where project_id is the same as the requester or project_id is different but the scope is public.
Parameters: |
|
---|---|
Return type: |
GET
/v2/tasks
¶Return the specified action_execution.
Parameters: |
|
---|---|
Return type: |
Cron trigger is an object that allows to run Mistral workflows according to a time pattern (Unix crontab patterns format). Once a trigger is created it will run a specified workflow according to its properties: pattern, first_execution_time and remaining_executions.
CronTrigger
¶CronTrigger resource.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "my_trigger",
"pattern": "* * * * *",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"remaining_executions": 42,
"scope": "private",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_id": "123e4567-e89b-12d3-a456-426655441111",
"workflow_input": "{}",
"workflow_name": "my_wf",
"workflow_params": "{}"
}
CronTriggers
¶A collection of cron triggers.
Data samples:
{
"cron_triggers": [
{
"created_at": "1970-01-01T00:00:00.000000",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "my_trigger",
"pattern": "* * * * *",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"remaining_executions": 42,
"scope": "private",
"updated_at": "1970-01-01T00:00:00.000000",
"workflow_id": "123e4567-e89b-12d3-a456-426655441111",
"workflow_input": "{}",
"workflow_name": "my_wf",
"workflow_params": "{}"
}
]
}
GET
/v2/cron_triggers
¶Return all cron triggers.
Parameters: |
|
---|---|
Return type: |
GET
/v2/cron_triggers
¶Returns the named cron_trigger.
Parameters: |
|
---|---|
Return type: |
POST
/v2/cron_triggers
¶Creates a new cron trigger.
Parameters: |
|
---|---|
Return type: |
DELETE
/v2/cron_triggers
¶Delete cron trigger.
Parameters: |
|
---|
Environment contains a set of variables which can be used in specific workflow.
Using an Environment it is possible to create and map action default values -
just provide ‘__actions’ key in ‘variables’. All these variables can be
accessed using the Workflow Language with the <% $.__env %>
expression.
Example of usage:
workflow:
tasks:
task1:
action: std.echo output=<% $.__env.my_echo_output %>
Example of creating action defaults
...ENV...
"variables": {
"__actions": {
"std.echo": {
"output": "my_output"
}
}
},
...ENV...
Note: using CLI, Environment can be created via JSON or YAML file.
Environment
¶Environment resource.
Data samples:
{
"created_at": "1970-01-01T00:00:00.000000",
"description": "example environment entry",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "sample",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"scope": "private",
"updated_at": "1970-01-01T00:00:00.000000",
"variables": "{\"database\": \"temp\", \"verbose\": true, \"timeout\": 600, \"server\": \"localhost\"}"
}
Environments
¶A collection of Environment resources.
Data samples:
{
"environments": [
{
"created_at": "1970-01-01T00:00:00.000000",
"description": "example environment entry",
"id": "123e4567-e89b-12d3-a456-426655440000",
"name": "sample",
"project_id": "40a908dbddfe48ad80a87fb30fa70a03",
"scope": "private",
"updated_at": "1970-01-01T00:00:00.000000",
"variables": "{\"database\": \"temp\", \"verbose\": true, \"timeout\": 600, \"server\": \"localhost\"}"
}
]
}
GET
/v2/environments
¶Return all environments.
Where project_id is the same as the requester or project_id is different but the scope is public.
Parameters: |
|
---|---|
Return type: |
GET
/v2/environments
¶Return the named environment.
Parameters: |
|
---|---|
Return type: |
POST
/v2/environments
¶Create a new environment.
Parameters: |
|
---|---|
Return type: |
PUT
/v2/environments
¶Update an environment.
Parameters: |
|
---|---|
Return type: |
DELETE
/v2/environments
¶Delete the named environment.
Parameters: |
|
---|
Through service management API, system administrator or operator can retrieve Mistral services information of the system, including service group and service identifier. The internal implementation of this feature make use of tooz library, which needs coordinator backend(the most commonly used at present is Zookeeper) installed, please refer to tooz official documentation for more detailed instruction.
There are three service groups according to Mistral architecture currently, namely api_group, engine_group and executor_group. The service identifier contains name of the host that the service is running on and the process identifier of the service on that host.
Service
¶Service resource.
Data samples:
{
"name": "host1_1234",
"type": "executor_group"
}
Services
¶A collection of Services.
Data samples:
{
"services": [
{
"name": "host1_1234",
"type": "executor_group"
}
]
}
Validation endpoints allow to check correctness of workbook, workflow and ad-hoc action Workflow Language without having to upload them into Mistral.
These endpoints expect workbook, workflow or ad-hoc action text (Workflow Language) correspondingly in a request body.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.