History

Retrieve execution history and track action results for auditing and monitoring purposes.

Overview

The Action History endpoints provide comprehensive tracking and auditing capabilities for executed actions. These endpoints are essential for monitoring system activity, debugging issues, and maintaining audit trails.

Get Action History

GET /api/Action/history

Retrieve a paginated list of action execution history.

Request Headers

GET https://your-mindzie-instance.com/api/Action/history?page=1&limit=50&status=completed
Authorization: Bearer {your-access-token}
X-Tenant-Id: {tenant-guid}
X-Project-Id: {project-guid}
Content-Type: application/json

Query Parameters

Parameter Type Required Description
page integer No Page number for pagination (default: 1)
limit integer No Number of items per page (default: 50, max: 100)
status string No Filter by status: "queued", "processing", "completed", "failed"
actionType string No Filter by action type
fromDate datetime No Filter actions from this date (ISO 8601 format)
toDate datetime No Filter actions until this date (ISO 8601 format)

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "actions": [
    {
      "actionId": "87654321-4321-4321-4321-210987654321",
      "actionType": "analyze",
      "status": "completed",
      "startTime": "2024-01-15T10:30:00Z",
      "endTime": "2024-01-15T10:32:15Z",
      "duration": 135,
      "userId": "user@company.com",
      "parameters": {
        "datasetId": "12345678-1234-1234-1234-123456789012",
        "analysisType": "process_discovery"
      },
      "result": {
        "outputId": "98765432-8765-4321-4321-987654321098",
        "recordsProcessed": 10000,
        "insights": 25
      }
    },
    {
      "actionId": "11111111-2222-3333-4444-555555555555",
      "actionType": "export",
      "status": "failed",
      "startTime": "2024-01-15T09:15:00Z",
      "endTime": "2024-01-15T09:15:30Z",
      "duration": 30,
      "userId": "user@company.com",
      "parameters": {
        "datasetId": "invalid-dataset-id",
        "format": "csv"
      },
      "error": {
        "code": "dataset_not_found",
        "message": "The specified dataset could not be found"
      }
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalItems": 250,
    "itemsPerPage": 50,
    "hasNext": true,
    "hasPrevious": false
  }
}

Get Specific Action Details

GET /api/Action/history/{actionId}

Retrieve detailed information about a specific action execution.

Request Headers

GET https://your-mindzie-instance.com/api/Action/history/87654321-4321-4321-4321-210987654321
Authorization: Bearer {your-access-token}
X-Tenant-Id: {tenant-guid}
X-Project-Id: {project-guid}
Content-Type: application/json

Path Parameters

Parameter Type Required Description
actionId GUID Yes Unique identifier of the action

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "actionId": "87654321-4321-4321-4321-210987654321",
  "actionType": "analyze",
  "status": "completed",
  "startTime": "2024-01-15T10:30:00Z",
  "endTime": "2024-01-15T10:32:15Z",
  "duration": 135,
  "userId": "user@company.com",
  "tenantId": "12345678-1234-1234-1234-123456789012",
  "projectId": "87654321-4321-4321-4321-210987654321",
  "parameters": {
    "datasetId": "12345678-1234-1234-1234-123456789012",
    "analysisType": "process_discovery",
    "filters": ["activity_filter", "time_period"]
  },
  "configuration": {
    "async": true,
    "timeout": 300,
    "priority": "high"
  },
  "progress": {
    "steps": [
      {
        "stepName": "data_loading",
        "status": "completed",
        "startTime": "2024-01-15T10:30:00Z",
        "endTime": "2024-01-15T10:30:30Z",
        "duration": 30
      },
      {
        "stepName": "process_discovery",
        "status": "completed",
        "startTime": "2024-01-15T10:30:30Z",
        "endTime": "2024-01-15T10:32:00Z",
        "duration": 90
      },
      {
        "stepName": "result_generation",
        "status": "completed",
        "startTime": "2024-01-15T10:32:00Z",
        "endTime": "2024-01-15T10:32:15Z",
        "duration": 15
      }
    ]
  },
  "result": {
    "outputId": "98765432-8765-4321-4321-987654321098",
    "recordsProcessed": 10000,
    "insights": 25,
    "outputFiles": [
      {
        "fileName": "process_map.json",
        "fileSize": 1024000,
        "downloadUrl": "/api/files/download/98765432-8765-4321-4321-987654321098"
      }
    ]
  },
  "metadata": {
    "source": "api",
    "userAgent": "mindzieClient/1.0",
    "ipAddress": "192.168.1.100"
  }
}

Error Responses

HTTP/1.1 404 Not Found
Content-Type: application/json

{
  "error": "action_not_found",
  "message": "The specified action could not be found",
  "actionId": "87654321-4321-4321-4321-210987654321"
}

Action Status Values

Status Description Next Steps
queued Action is queued and waiting to be processed Monitor for status changes
processing Action is currently being executed Monitor progress updates
completed Action completed successfully Retrieve results
failed Action failed to execute Check error details and retry if appropriate
cancelled Action was cancelled by user or system No further action needed

Implementation Examples

JavaScript/Node.js

// Get action history with filters
const getActionHistory = async (token, tenantId, projectId, filters = {}) => {
  const queryParams = new URLSearchParams();

  if (filters.status) queryParams.append('status', filters.status);
  if (filters.actionType) queryParams.append('actionType', filters.actionType);
  if (filters.page) queryParams.append('page', filters.page);
  if (filters.limit) queryParams.append('limit', filters.limit);
  if (filters.fromDate) queryParams.append('fromDate', filters.fromDate);
  if (filters.toDate) queryParams.append('toDate', filters.toDate);

  const url = `https://your-mindzie-instance.com/api/Action/history?${queryParams}`;

  try {
    const response = await fetch(url, {
      headers: {
        'Authorization': `Bearer ${token}`,
        'X-Tenant-Id': tenantId,
        'X-Project-Id': projectId,
        'Content-Type': 'application/json'
      }
    });

    if (response.ok) {
      return await response.json();
    } else {
      throw new Error(`Failed to get action history: ${response.status}`);
    }
  } catch (error) {
    console.error('Error getting action history:', error);
    throw error;
  }
};

// Get specific action details
const getActionDetails = async (actionId, token, tenantId, projectId) => {
  try {
    const response = await fetch(`https://your-mindzie-instance.com/api/Action/history/${actionId}`, {
      headers: {
        'Authorization': `Bearer ${token}`,
        'X-Tenant-Id': tenantId,
        'X-Project-Id': projectId,
        'Content-Type': 'application/json'
      }
    });

    if (response.ok) {
      return await response.json();
    } else {
      throw new Error(`Failed to get action details: ${response.status}`);
    }
  } catch (error) {
    console.error('Error getting action details:', error);
    throw error;
  }
};

Python

import requests
from datetime import datetime, timedelta

def get_action_history(token, tenant_id, project_id, **filters):
    url = 'https://your-mindzie-instance.com/api/Action/history'

    headers = {
        'Authorization': f'Bearer {token}',
        'X-Tenant-Id': tenant_id,
        'X-Project-Id': project_id,
        'Content-Type': 'application/json'
    }

    # Build query parameters
    params = {}
    for key, value in filters.items():
        if value is not None:
            params[key] = value

    try:
        response = requests.get(url, headers=headers, params=params)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f'Error getting action history: {e}')
        raise

def get_action_details(action_id, token, tenant_id, project_id):
    url = f'https://your-mindzie-instance.com/api/Action/history/{action_id}'

    headers = {
        'Authorization': f'Bearer {token}',
        'X-Tenant-Id': tenant_id,
        'X-Project-Id': project_id,
        'Content-Type': 'application/json'
    }

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f'Error getting action details: {e}')
        raise

# Example usage
history = get_action_history(
    'your_token',
    'your_tenant_id',
    'your_project_id',
    status='completed',
    page=1,
    limit=25,
    fromDate=(datetime.now() - timedelta(days=7)).isoformat()
)

Best Practices

  • Pagination: Always use pagination for large result sets to improve performance
  • Date Filtering: Use date filters to limit results to relevant time periods
  • Status Monitoring: Regularly check action status for long-running operations
  • Error Analysis: Use detailed error information for troubleshooting failed actions
  • Audit Trails: Maintain action history for compliance and auditing purposes
  • Performance Monitoring: Track action duration and success rates for performance optimization
An error has occurred. This application may no longer respond until reloaded. Reload ??