Blokresultaten

Analyseresultaten Ophalen

Toegang tot uitvoeringsgeschiedenis en resultaten van voltooide blokuitvoeringen. Verkrijg verwerkte resultaten van filters, berekeningen en waarschuwingen.

Blokresultaten Ophalen

GET /api/{tenantId}/{projectId}/block/{blockId}/results

Haalt metadata op van de uitvoeringsgeschiedenis voor een specifiek blok. Resultaten bevatten uitvoertijden en statusinformatie.

Padparameters

Parameter Type Verplicht Beschrijving
tenantId GUID Ja De tenant-identificatie
projectId GUID Ja De projectidentificatie
blockId GUID Ja De blokidentificatie

Respons (200 OK)

{
  "blockId": "550e8400-e29b-41d4-a716-446655440000",
  "message": "Block execution history not yet implemented",
  "executions": []
}

Response Codes

  • 200 OK - Verzoek succesvol
  • 401 Unauthorized - Ongeldige authenticatie of onvoldoende rechten
  • 404 Not Found - Blok niet gevonden of geen toegang
  • 500 Internal Server Error - Serverfout opgetreden

Blok Output Data Ophalen

GET /api/{tenantId}/{projectId}/block/{blockId}/output-data

Haalt de getransformeerde dataset op die door het blok is geproduceerd.

Belangrijk: Dit endpoint geeft aanwijzingen om de ExecutionController-workflow te gebruiken voor het daadwerkelijk ophalen van output data, omdat blok output data alleen beschikbaar is via de in-memory projectcache.

Padparameters

Parameter Type Verplicht Beschrijving
tenantId GUID Ja De tenant-identificatie
projectId GUID Ja De projectidentificatie
blockId GUID Ja De blokidentificatie

Respons (501 Not Implemented)

{
  "Error": "Block output data retrieval not implemented via database API",
  "BlockId": "550e8400-e29b-41d4-a716-446655440000",
  "Message": "To retrieve block output data, use the ExecutionController workflow: 1. Load project into cache via ProjectController.LoadProject, 2. Execute notebook via ExecutionController.ExecuteNotebook, 3. Retrieve results via ExecutionController.GetNotebookResults",
  "Recommendation": "GET /api/{tenantId}/{projectId}/execution/notebook/{notebookId}/results"
}

Aanbevolen Workflow voor Blok Output

Om de daadwerkelijke blokoutputdata op te halen, volgt u deze workflow via de Execution API:

  1. Project in Cache Laden

    GET /api/{tenantId}/{projectId}/project/{projectId}/load
    
  2. Notebook Uitvoeren

    POST /api/{tenantId}/{projectId}/execution/notebook/{notebookId}
    
  3. Notebook Resultaten Ophalen

    GET /api/{tenantId}/{projectId}/execution/notebook/{notebookId}/results
    

Zie Execution API voor volledige documentatie.

Implementatie Voorbeelden

cURL

# Metadata van blokresultaten ophalen
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/block/550e8400-e29b-41d4-a716-446655440000/results" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# Poging tot ophalen output data (geeft aanwijzingen terug)
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/block/550e8400-e29b-41d4-a716-446655440000/output-data" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

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';

class BlockResultsClient {
  constructor(token) {
    this.headers = {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    };
  }

  async getBlockResults(blockId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/block/${blockId}/results`;
    const response = await fetch(url, { headers: this.headers });

    if (response.ok) {
      return await response.json();
    }

    throw new Error(`Failed to get results: ${response.status}`);
  }

  async getBlockOutputData(blockId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/block/${blockId}/output-data`;
    const response = await fetch(url, { headers: this.headers });

    // Let op: dit endpoint retourneert 501 met aanwijzingen
    return await response.json();
  }
}

// Gebruik
const client = new BlockResultsClient('your-auth-token');

// Resultaten metadata ophalen
const results = await client.getBlockResults('block-guid');
console.log(`Block: ${results.blockId}`);
console.log(`Executions: ${results.executions.length}`);

// Output data aanwijzingen controleren
const outputInfo = await client.getBlockOutputData('block-guid');
console.log(`Recommendation: ${outputInfo.Recommendation}`);

Python

import requests

TENANT_ID = '12345678-1234-1234-1234-123456789012'
PROJECT_ID = '87654321-4321-4321-4321-210987654321'
BASE_URL = 'https://your-mindzie-instance.com'

class BlockResultsClient:
    def __init__(self, token):
        self.headers = {
            'Authorization': f'Bearer {token}',
            'Content-Type': 'application/json'
        }

    def get_block_results(self, block_id):
        """Metadata van blokuitvoeringsresultaten ophalen."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/block/{block_id}/results'
        response = requests.get(url, headers=self.headers)

        if response.ok:
            return response.json()
        else:
            raise Exception(f'Failed to get results: {response.status_code}')

    def get_block_output_data(self, block_id):
        """Aanwijzingen ophalen voor blok output data."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/block/{block_id}/output-data'
        response = requests.get(url, headers=self.headers)
        return response.json()

# Gebruik
client = BlockResultsClient('your-auth-token')

# Resultaten ophalen
results = client.get_block_results('block-guid')
print(f"Block: {results['blockId']}")

# Output data aanwijzingen ophalen
output_info = client.get_block_output_data('block-guid')
print(f"Recommendation: {output_info.get('Recommendation', 'N/A')}")

C#

using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

public class BlockResultsClient
{
    private readonly HttpClient _httpClient;
    private readonly string _baseUrl;
    private readonly Guid _tenantId;
    private readonly Guid _projectId;

    public BlockResultsClient(string baseUrl, Guid tenantId, Guid projectId, string accessToken)
    {
        _baseUrl = baseUrl;
        _tenantId = tenantId;
        _projectId = projectId;
        _httpClient = new HttpClient();
        _httpClient.DefaultRequestHeaders.Authorization =
            new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken);
    }

    public async Task<JsonDocument> GetBlockResultsAsync(Guid blockId)
    {
        var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/block/{blockId}/results";
        var response = await _httpClient.GetAsync(url);

        if (response.IsSuccessStatusCode)
        {
            var json = await response.Content.ReadAsStringAsync();
            return JsonDocument.Parse(json);
        }

        throw new Exception($"Failed to get results: {response.StatusCode}");
    }

    public async Task<JsonDocument> GetBlockOutputDataAsync(Guid blockId)
    {
        var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/block/{blockId}/output-data";
        var response = await _httpClient.GetAsync(url);

        // Retourneert 501 met aanwijzingen
        var json = await response.Content.ReadAsStringAsync();
        return JsonDocument.Parse(json);
    }
}

Belangrijke Opmerkingen

  • Results Endpoint: Retourneert momenteel metadata van de uitvoeringsgeschiedenis. Volledige uitvoeringgeschiedenis wordt nog ontwikkeld.
  • Output Data: Blok output data is alleen beschikbaar via de in-memory projectcache. Gebruik de ExecutionController-workflow voor daadwerkelijke data-ophaling.
  • Beste Praktijk: Voor volledige blokoutput, laad het project, voer het notebook uit, en haal resultaten op via de Execution API.