Eylem Çalıştırma Geçmişi

Eylem çalıştırma geçmişini takip edin, izleyin ve sonuç paketlerini indirin.

Genel Bakış

Action Execution API, eylem çalıştırma geçmişinin takibi, durum izlemesi ve çalıştırma sonuçlarının indirilmesi için uç noktalar sağlar. Bu API, ana Actions API'den ayrı bir denetleyici kullanır.

Temel URL: /api/{tenantId}/{projectId}/actionexecution

Bir Eylem İçin Çalıştırma Geçmişini Al

GET /api/{tenantId}/{projectId}/actionexecution/action/{actionId}

Belirli bir eyleme ait tüm çalıştırma geçmişini alın.

İstek

GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/action/{actionId}
Authorization: Bearer {your-access-token}

Yol Parametreleri

Parametre Tür Gerekli Açıklama
tenantId GUID Evet Kiracı tanımlayıcınız
projectId GUID Evet Proje tanımlayıcınız
actionId GUID Evet Çalıştırma geçmişi alınacak eylem

Yanıt

Başarılı (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
    }
  ]
}

Bir Eylemin Son Çalıştırmasını Al

GET /api/{tenantId}/{projectId}/actionexecution/lastaction/{actionId}

Belirli bir eylemin en son çalıştırmasını alın.

İstek

GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/lastaction/{actionId}
Authorization: Bearer {your-access-token}

Yol Parametreleri

Parametre Tür Gerekli Açıklama
tenantId GUID Evet Kiracı tanımlayıcınız
projectId GUID Evet Proje tanımlayıcınız
actionId GUID Evet Son çalıştırması alınacak eylem

Yanıt

Başarılı (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
}

Bulunamadı (404):

{
  "error": "Can't find action",
  "actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
}

Belirli Bir Çalıştırma Detaylarını Al

GET /api/{tenantId}/{projectId}/actionexecution/{executionId}

Çalıştırma ID'si ile belirli bir çalıştırmanın detaylarını alın.

İstek

GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/{executionId}
Authorization: Bearer {your-access-token}

Yol Parametreleri

Parametre Tür Gerekli Açıklama
tenantId GUID Evet Kiracı tanımlayıcınız
projectId GUID Evet Proje tanımlayıcınız
executionId GUID Evet Detayı alınacak çalıştırma

Yanıt

Başarılı (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
}

Bulunamadı (404):

{
  "error": "Can't find action",
  "executionId": "11111111-2222-3333-4444-555555555555"
}

Çalıştırma Paketini İndir

GET /api/{tenantId}/{projectId}/actionexecution/downloadpackage/{executionId}

Tamamlanmış bir çalıştırma için sonuç paketi (ZIP dosyası) indirin.

İstek

GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/downloadpackage/{executionId}
Authorization: Bearer {your-access-token}

Yol Parametreleri

Parametre Tür Gerekli Açıklama
tenantId GUID Evet Kiracı tanımlayıcınız
projectId GUID Evet Proje tanımlayıcınız
executionId GUID Evet Sonuçları indirilecek çalıştırma

Yanıt

Başarılı (200 OK):

Çalıştırma sonuçları, raporlar ve öğeler içeren bir ZIP dosyası indirmesi döner.

HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment; filename="{executionId}.zip"

[binary ZIP file content]

Bulunamadı (404):

{
  "error": "Execution not found",
  "executionId": "11111111-2222-3333-4444-555555555555"
}
{
  "error": "Zip file not found",
  "executionId": "11111111-2222-3333-4444-555555555555"
}

Çalıştırma Yanıt Alanları

Alan Tür Açıklama
actionId GUID Çalıştırılan eylem
actionExecutionId GUID Bu çalıştırmaya ait benzersiz kimlik
dateStarted datetime Çalıştırmanın başladığı zaman
dateEnded datetime Çalıştırmanın tamamlandığı zaman (hala çalışıyorsa null)
status string Mevcut çalıştırma durumu
notes string Çalıştırma notları veya hata mesajları

Çalıştırma Durum Değerleri

Durum Açıklama
Queued Çalıştırma sırada, başlayacak
Running Çalıştırma şu anda devam ediyor
Completed Çalıştırma başarıyla tamamlandı
Failed Çalıştırma hatayla karşılaştı

Uygulama Örnekleri

cURL

# Bir eylem için çalıştırma geçmişini al
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"

# Son çalıştırmayı al
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"

# Belirli çalıştırmayı al
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"

# Çalıştırma paketini indir
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';

// Bir eylem için çalıştırma geçmişini al
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(`Başarısız oldu: ${response.status}`);
};

// Bir eylemin son çalıştırmasını al
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(`Başarısız oldu: ${response.status}`);
};

// Belirli çalıştırma detaylarını al
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(`Başarısız oldu: ${response.status}`);
};

// Çalıştırma paketini indir
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();
    // ZIP dosyasını kaydet veya işle
    return blob;
  }
  throw new Error(`Başarısız oldu: ${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):
    """Bir eyleme ait tüm çalıştırmaları al."""
    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):
    """Bir eylemin en son çalıştırmasını al."""
    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):
    """Belirli bir çalıştırmanın detaylarını al."""
    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):
    """Çalıştırma sonuç paketini indir."""
    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

# Örnek: Çalıştırma tamamlanana kadar bekle
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'Çalıştırma başarıyla tamamlandı')
            return execution
        elif status == 'Failed':
            print(f'Çalıştırma hatayla sonuçlandı: {execution.get("notes", "Bilinmeyen hata")}')
            return execution
        else:
            print(f'Durum: {status}, bekleniyor...')
            time.sleep(5)

    raise TimeoutError('Çalıştırma belirtilen sürede tamamlanmadı')

En İyi Uygulamalar

  • Durumu Sorgulayın: Bir eylemi çalıştırdıktan sonra ilerlemeyi izlemek için çalıştırma uç noktasını düzenli olarak sorgulayın
  • Uzun Süren Eylemlerle Baş Edin: Tamamlanmayı beklerken uygun zaman aşımı değerleri kullanın
  • Sonuçları İndirin: Çıktı üreten eylemler için tamamlandıktan sonra paketi indirin
  • Hata Yönetimi: Durum "Failed" ise hata ayrıntıları için notes alanını kontrol edin
  • Çalıştırma Geçmişi: Geçmiş uç noktalarını denetim ve hata ayıklama için kullanın