Execute various actions and operations within mindzieStudio programmatically.
Overview
The Execute Actions endpoint allows you to trigger various operations within mindzieStudio programmatically. This is essential for automation scenarios, scheduled processes, and integration workflows.
Execute Action
POST /api/Action/execute
Execute a specific action with custom parameters and configuration.
Request Headers
POST https://your-mindzie-instance.com/api/Action/execute
Authorization: Bearer {your-access-token}
X-Tenant-Id: {tenant-guid}
X-Project-Id: {project-guid}
Content-Type: application/json
Request Body
{
"actionType": "string",
"parameters": {
"key1": "value1",
"key2": "value2"
},
"configuration": {
"async": true,
"timeout": 300,
"priority": "high"
},
"metadata": {
"source": "api",
"userId": "user@company.com",
"description": "Automated action execution"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
actionType |
string | Yes | Type of action to execute (e.g., "analyze", "export", "transform") |
parameters |
object | No | Action-specific parameters and configuration |
configuration |
object | No | Execution configuration options |
metadata |
object | No | Additional metadata for tracking and auditing |
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"actionId": "87654321-4321-4321-4321-210987654321",
"status": "queued",
"timestamp": "2024-01-15T10:30:00Z",
"estimatedDuration": 120,
"trackingUrl": "/api/Action/status/87654321-4321-4321-4321-210987654321",
"message": "Action queued for execution"
}
Asynchronous Response
HTTP/1.1 202 Accepted
Content-Type: application/json
{
"actionId": "87654321-4321-4321-4321-210987654321",
"status": "processing",
"timestamp": "2024-01-15T10:30:00Z",
"progress": {
"percentage": 0,
"currentStep": "initializing",
"totalSteps": 5
},
"trackingUrl": "/api/Action/status/87654321-4321-4321-4321-210987654321"
}
Error Responses
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": "invalid_action_type",
"message": "The specified action type is not supported",
"details": {
"actionType": "unknown_action",
"supportedTypes": ["analyze", "export", "transform", "import"]
}
}
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json
{
"error": "validation_failed",
"message": "Required parameters are missing or invalid",
"details": {
"missingParameters": ["datasetId"],
"invalidParameters": ["timeout"]
}
}
Common Action Types
Data Analysis
{
"actionType": "analyze",
"parameters": {
"datasetId": "12345678-1234-1234-1234-123456789012",
"analysisType": "process_discovery",
"filters": ["activity_filter", "time_period"],
"outputFormat": "json"
}
}
Data Export
{
"actionType": "export",
"parameters": {
"datasetId": "12345678-1234-1234-1234-123456789012",
"format": "csv",
"includeHeaders": true,
"filters": {
"dateRange": "last_30_days"
}
}
}
Data Transformation
{
"actionType": "transform",
"parameters": {
"sourceDatasetId": "12345678-1234-1234-1234-123456789012",
"transformationType": "enrichment",
"enrichmentRules": ["case_duration", "activity_frequency"],
"targetDatasetName": "enriched_dataset"
}
}
Implementation Examples
JavaScript/Node.js
const executeAction = async (actionType, parameters, token, tenantId, projectId) => {
const requestBody = {
actionType: actionType,
parameters: parameters,
configuration: {
async: true,
timeout: 300
},
metadata: {
source: "javascript_client",
timestamp: new Date().toISOString()
}
};
try {
const response = await fetch('https://your-mindzie-instance.com/api/Action/execute', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'X-Tenant-Id': tenantId,
'X-Project-Id': projectId,
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
});
if (response.ok) {
const result = await response.json();
console.log('Action executed:', result);
return result;
} else {
throw new Error(`Action execution failed: ${response.status}`);
}
} catch (error) {
console.error('Error executing action:', error);
throw error;
}
};
Python
import requests
import json
from datetime import datetime
def execute_action(action_type, parameters, token, tenant_id, project_id):
url = 'https://your-mindzie-instance.com/api/Action/execute'
headers = {
'Authorization': f'Bearer {token}',
'X-Tenant-Id': tenant_id,
'X-Project-Id': project_id,
'Content-Type': 'application/json'
}
payload = {
'actionType': action_type,
'parameters': parameters,
'configuration': {
'async': True,
'timeout': 300
},
'metadata': {
'source': 'python_client',
'timestamp': datetime.utcnow().isoformat()
}
}
try:
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error executing action: {e}')
raise
# Example usage
result = execute_action(
'analyze',
{'datasetId': '12345678-1234-1234-1234-123456789012', 'analysisType': 'process_discovery'},
'your_token',
'your_tenant_id',
'your_project_id'
)
Best Practices
- Async Operations: Use asynchronous execution for long-running actions to avoid timeouts
- Progress Tracking: Always store the actionId to track execution progress
- Error Handling: Implement comprehensive error handling for validation and execution failures
- Parameter Validation: Validate parameters client-side before sending requests
- Metadata Usage: Include meaningful metadata for auditing and debugging
- Timeout Settings: Set appropriate timeout values based on expected action duration