Action Execution History
Track and monitor action execution history and download result packages.
Overview
The Action Execution API provides endpoints for tracking action execution history, monitoring status, and downloading execution results. This API uses a separate controller from the main Actions API.
Base URL: /api/{tenantId}/{projectId}/actionexecution
Get Execution History for an Action
GET /api/{tenantId}/{projectId}/actionexecution/action/{actionId}
Retrieve all execution history for a specific action.
Request
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/action/{actionId}
Authorization: Bearer {your-access-token}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId |
GUID | Yes | Your tenant identifier |
projectId |
GUID | Yes | Your project identifier |
actionId |
GUID | Yes | The action to get execution history for |
Response
Success (200 OK):
{
"items": [
{
"actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"actionExecutionId": "11111111-2222-3333-4444-555555555555",
"dateStarted": "2024-01-15T10:30:00Z",
"dateEnded": "2024-01-15T10:32:15Z",
"status": "Completed",
"notes": null
},
{
"actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"actionExecutionId": "22222222-3333-4444-5555-666666666666",
"dateStarted": "2024-01-14T10:30:00Z",
"dateEnded": "2024-01-14T10:31:45Z",
"status": "Completed",
"notes": null
}
]
}
Get Last Execution for an Action
GET /api/{tenantId}/{projectId}/actionexecution/lastaction/{actionId}
Retrieve the most recent execution for a specific action.
Request
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/lastaction/{actionId}
Authorization: Bearer {your-access-token}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId |
GUID | Yes | Your tenant identifier |
projectId |
GUID | Yes | Your project identifier |
actionId |
GUID | Yes | The action to get the last execution for |
Response
Success (200 OK):
{
"actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"actionExecutionId": "11111111-2222-3333-4444-555555555555",
"dateStarted": "2024-01-15T10:30:00Z",
"dateEnded": "2024-01-15T10:32:15Z",
"status": "Completed",
"notes": null
}
Not Found (404):
{
"error": "Can't find action",
"actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
}
Get Specific Execution Details
GET /api/{tenantId}/{projectId}/actionexecution/{executionId}
Retrieve details for a specific execution by its execution ID.
Request
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/{executionId}
Authorization: Bearer {your-access-token}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId |
GUID | Yes | Your tenant identifier |
projectId |
GUID | Yes | Your project identifier |
executionId |
GUID | Yes | The execution to retrieve |
Response
Success (200 OK):
{
"actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"actionExecutionId": "11111111-2222-3333-4444-555555555555",
"dateStarted": "2024-01-15T10:30:00Z",
"dateEnded": "2024-01-15T10:32:15Z",
"status": "Completed",
"notes": null
}
Not Found (404):
{
"error": "Can't find action",
"executionId": "11111111-2222-3333-4444-555555555555"
}
Download Execution Package
GET /api/{tenantId}/{projectId}/actionexecution/downloadpackage/{executionId}
Download the results package (ZIP file) for a completed execution.
Request
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/downloadpackage/{executionId}
Authorization: Bearer {your-access-token}
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId |
GUID | Yes | Your tenant identifier |
projectId |
GUID | Yes | Your project identifier |
executionId |
GUID | Yes | The execution to download results for |
Response
Success (200 OK):
Returns a ZIP file download containing execution results, reports, and artifacts.
HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment; filename="{executionId}.zip"
[binary ZIP file content]
Not Found (404):
{
"error": "Execution not found",
"executionId": "11111111-2222-3333-4444-555555555555"
}
{
"error": "Zip file not found",
"executionId": "11111111-2222-3333-4444-555555555555"
}
Execution Response Fields
| Field | Type | Description |
|---|---|---|
actionId |
GUID | The action that was executed |
actionExecutionId |
GUID | Unique identifier for this execution |
dateStarted |
datetime | When execution started |
dateEnded |
datetime | When execution completed (null if still running) |
status |
string | Current execution status |
notes |
string | Execution notes or error messages |
Execution Status Values
| Status | Description |
|---|---|
| Queued | Execution is queued, waiting to start |
| Running | Execution is currently in progress |
| Completed | Execution finished successfully |
| Failed | Execution encountered an error |
Implementation Examples
cURL
# Get execution history for an action
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/actionexecution/action/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# Get last execution
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/actionexecution/lastaction/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# Get specific execution
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/actionexecution/11111111-2222-3333-4444-555555555555" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# Download execution package
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/actionexecution/downloadpackage/11111111-2222-3333-4444-555555555555" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-o execution_results.zip
JavaScript/Node.js
const TENANT_ID = '12345678-1234-1234-1234-123456789012';
const PROJECT_ID = '87654321-4321-4321-4321-210987654321';
const BASE_URL = 'https://your-mindzie-instance.com';
// Get execution history for an action
const getExecutionHistory = async (actionId, token) => {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/actionexecution/action/${actionId}`;
const response = await fetch(url, {
headers: { 'Authorization': `Bearer ${token}` }
});
if (response.ok) {
const result = await response.json();
return result.items;
}
throw new Error(`Failed: ${response.status}`);
};
// Get last execution for an action
const getLastExecution = async (actionId, token) => {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/actionexecution/lastaction/${actionId}`;
const response = await fetch(url, {
headers: { 'Authorization': `Bearer ${token}` }
});
if (response.ok) {
return await response.json();
} else if (response.status === 404) {
return null;
}
throw new Error(`Failed: ${response.status}`);
};
// Get specific execution details
const getExecution = async (executionId, token) => {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/actionexecution/${executionId}`;
const response = await fetch(url, {
headers: { 'Authorization': `Bearer ${token}` }
});
if (response.ok) {
return await response.json();
}
throw new Error(`Failed: ${response.status}`);
};
// Download execution package
const downloadPackage = async (executionId, token) => {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/actionexecution/downloadpackage/${executionId}`;
const response = await fetch(url, {
headers: { 'Authorization': `Bearer ${token}` }
});
if (response.ok) {
const blob = await response.blob();
// Save or process the ZIP file
return blob;
}
throw new Error(`Failed: ${response.status}`);
};
Python
import requests
TENANT_ID = '12345678-1234-1234-1234-123456789012'
PROJECT_ID = '87654321-4321-4321-4321-210987654321'
BASE_URL = 'https://your-mindzie-instance.com'
def get_execution_history(action_id, token):
"""Get all executions for an action."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/actionexecution/action/{action_id}'
headers = {'Authorization': f'Bearer {token}'}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()['items']
def get_last_execution(action_id, token):
"""Get the most recent execution for an action."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/actionexecution/lastaction/{action_id}'
headers = {'Authorization': f'Bearer {token}'}
response = requests.get(url, headers=headers)
if response.status_code == 404:
return None
response.raise_for_status()
return response.json()
def get_execution(execution_id, token):
"""Get details for a specific execution."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/actionexecution/{execution_id}'
headers = {'Authorization': f'Bearer {token}'}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
def download_package(execution_id, token, output_path):
"""Download the execution results package."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/actionexecution/downloadpackage/{execution_id}'
headers = {'Authorization': f'Bearer {token}'}
response = requests.get(url, headers=headers)
response.raise_for_status()
with open(output_path, 'wb') as f:
f.write(response.content)
return output_path
# Example: Monitor execution until complete
def wait_for_completion(execution_id, token, max_wait_seconds=300):
import time
start_time = time.time()
while time.time() - start_time < max_wait_seconds:
execution = get_execution(execution_id, token)
status = execution['status']
if status == 'Completed':
print(f'Execution completed successfully')
return execution
elif status == 'Failed':
print(f'Execution failed: {execution.get("notes", "Unknown error")}')
return execution
else:
print(f'Status: {status}, waiting...')
time.sleep(5)
raise TimeoutError('Execution did not complete within timeout')
Best Practices
- Poll for Status: After executing an action, poll the execution endpoint to monitor progress
- Handle Long-Running Actions: Use appropriate timeouts when waiting for completion
- Download Results: For actions that produce output, download the package after completion
- Error Handling: Check the
notesfield for error details when status is "Failed" - Execution History: Use history endpoints for auditing and debugging past executions