Actie-uitvoeringsgeschiedenis
Volg en monitor de actie-uitvoeringsgeschiedenis en download resultaatpakketten.
Overzicht
De Action Execution API biedt eindpunten voor het volgen van de actie-uitvoeringsgeschiedenis, het monitoren van de status en het downloaden van uitvoeringsresultaten. Deze API gebruikt een aparte controller van de hoofd Actions API.
Basis-URL: /api/{tenantId}/{projectId}/actionexecution
Haal Uitvoeringsgeschiedenis op voor een Actie
GET /api/{tenantId}/{projectId}/actionexecution/action/{actionId}
Haal alle uitvoeringsgeschiedenis op voor een specifieke actie.
Verzoek
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/action/{actionId}
Authorization: Bearer {your-access-token}
Padparameters
| Parameter | Type | Vereist | Beschrijving |
|---|---|---|---|
tenantId |
GUID | Ja | Uw tenant-identificatie |
projectId |
GUID | Ja | Uw projectidentificatie |
actionId |
GUID | Ja | De actie waarvoor de uitvoeringsgeschiedenis wordt opgehaald |
Antwoord
Succes (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
}
]
}
Haal Laatste Uitvoering op voor een Actie
GET /api/{tenantId}/{projectId}/actionexecution/lastaction/{actionId}
Haal de meest recente uitvoering op voor een specifieke actie.
Verzoek
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/lastaction/{actionId}
Authorization: Bearer {your-access-token}
Padparameters
| Parameter | Type | Vereist | Beschrijving |
|---|---|---|---|
tenantId |
GUID | Ja | Uw tenant-identificatie |
projectId |
GUID | Ja | Uw projectidentificatie |
actionId |
GUID | Ja | De actie waarvoor de laatste uitvoering wordt opgehaald |
Antwoord
Succes (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
}
Niet Gevonden (404):
{
"error": "Can't find action",
"actionId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
}
Haal Specifieke Uitvoeringsdetails op
GET /api/{tenantId}/{projectId}/actionexecution/{executionId}
Haal details op voor een specifieke uitvoering via het uitvoering-ID.
Verzoek
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/{executionId}
Authorization: Bearer {your-access-token}
Padparameters
| Parameter | Type | Vereist | Beschrijving |
|---|---|---|---|
tenantId |
GUID | Ja | Uw tenant-identificatie |
projectId |
GUID | Ja | Uw projectidentificatie |
executionId |
GUID | Ja | De uitvoering die opgehaald wordt |
Antwoord
Succes (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
}
Niet Gevonden (404):
{
"error": "Can't find action",
"executionId": "11111111-2222-3333-4444-555555555555"
}
Download Uitvoeringspakket
GET /api/{tenantId}/{projectId}/actionexecution/downloadpackage/{executionId}
Download het resultaatpakket (ZIP-bestand) voor een voltooide uitvoering.
Verzoek
GET https://your-mindzie-instance.com/api/{tenantId}/{projectId}/actionexecution/downloadpackage/{executionId}
Authorization: Bearer {your-access-token}
Padparameters
| Parameter | Type | Vereist | Beschrijving |
|---|---|---|---|
tenantId |
GUID | Ja | Uw tenant-identificatie |
projectId |
GUID | Ja | Uw projectidentificatie |
executionId |
GUID | Ja | De uitvoering waarvoor resultaten worden gedownload |
Antwoord
Succes (200 OK):
Retourneert een ZIP-bestand download met uitvoeringsresultaten, rapporten en artefacten.
HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment; filename="{executionId}.zip"
[binaire ZIP-bestandsinhoud]
Niet Gevonden (404):
{
"error": "Execution not found",
"executionId": "11111111-2222-3333-4444-555555555555"
}
{
"error": "Zip file not found",
"executionId": "11111111-2222-3333-4444-555555555555"
}
Uitvoeringsantwoordvelden
| Veld | Type | Beschrijving |
|---|---|---|
actionId |
GUID | De uitgevoerde actie |
actionExecutionId |
GUID | Unieke identificatie voor deze uitvoering |
dateStarted |
datetime | Wanneer de uitvoering is gestart |
dateEnded |
datetime | Wanneer de uitvoering is voltooid (null als deze nog loopt) |
status |
string | Huidige uitvoeringsstatus |
notes |
string | Uitvoeringsnotities of foutmeldingen |
Uitvoeringsstatuswaarden
| Status | Beschrijving |
|---|---|
| Queued | Uitvoering staat in de wachtrij, wacht op start |
| Running | Uitvoering is momenteel bezig |
| Completed | Uitvoering is succesvol voltooid |
| Failed | Uitvoering is mislukt |
Implementatievoorbeelden
cURL
# Haal uitvoeringsgeschiedenis op voor een actie
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"
# Haal laatste uitvoering op
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"
# Haal specifieke uitvoering op
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 uitvoeringspakket
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';
// Haal uitvoeringsgeschiedenis op voor een actie
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}`);
};
// Haal laatste uitvoering op voor een actie
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}`);
};
// Haal specifieke uitvoeringsdetails op
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 uitvoeringspakket
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();
// Sla het ZIP-bestand op of verwerk het
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):
"""Haalt alle uitvoeringen op voor een actie."""
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):
"""Haalt de meest recente uitvoering op voor een actie."""
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):
"""Haalt details op voor een specifieke uitvoering."""
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 het uitvoeringsresultatenpakket."""
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
# Voorbeeld: Monitor uitvoering totdat deze is voltooid
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'Uitvoering succesvol voltooid')
return execution
elif status == 'Failed':
print(f'Uitvoering mislukt: {execution.get("notes", "Onbekende fout")}')
return execution
else:
print(f'Status: {status}, wachten...')
time.sleep(5)
raise TimeoutError('Uitvoering is niet voltooid binnen de time-outperiode')
Best Practices
- Poll op Status: Na het uitvoeren van een actie, polling het uitvoerings-eindpunt om de voortgang te monitoren
- Hanteer Langdurige Acties: Gebruik geschikte time-outs bij het wachten op voltooiing
- Download Resultaten: Voor acties die output genereren, download het pakket na voltooiing
- Foutafhandeling: Controleer het veld
notesvoor foutdetails wanneer de status "Failed" is - Uitvoeringsgeschiedenis: Gebruik historie-eindpunten voor auditing en debugging van eerdere uitvoeringen