Block Results

Retrieve Analysis Results

Access execution history and results from completed block executions. Get processed results from filters, calculations, and alerts.

Get Block Results

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

Retrieves execution history metadata for a specific block. Results include execution timestamps and status information.

Path Parameters

Parameter Type Required Description
tenantId GUID Yes The tenant identifier
projectId GUID Yes The project identifier
blockId GUID Yes The block identifier

Response (200 OK)

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

Response Codes

  • 200 OK - Request successful
  • 401 Unauthorized - Invalid authentication or insufficient permissions
  • 404 Not Found - Block not found or no access
  • 500 Internal Server Error - Server error occurred

Get Block Output Data

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

Retrieves the transformed dataset produced by the block.

Important: This endpoint returns guidance to use the ExecutionController workflow for actual output data retrieval, as block output data is only available through the in-memory project cache.

Path Parameters

Parameter Type Required Description
tenantId GUID Yes The tenant identifier
projectId GUID Yes The project identifier
blockId GUID Yes The block identifier

Response (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"
}

To retrieve actual block output data, follow this workflow using the Execution API:

  1. Load Project into Cache

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

    POST /api/{tenantId}/{projectId}/execution/notebook/{notebookId}
    
  3. Get Notebook Results

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

See Execution API for complete documentation.

Implementation Examples

cURL

# Get block results metadata
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"

# Attempt to get output data (returns guidance)
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 });

    // Note: This endpoint returns 501 with guidance
    return await response.json();
  }
}

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

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

// Check output data guidance
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):
        """Get block execution results metadata."""
        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):
        """Get block output data guidance."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/block/{block_id}/output-data'
        response = requests.get(url, headers=self.headers)
        return response.json()

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

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

# Get output data guidance
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);

        // Returns 501 with guidance
        var json = await response.Content.ReadAsStringAsync();
        return JsonDocument.Parse(json);
    }
}

Important Notes

  • Results Endpoint: Currently returns execution history metadata. Full execution history retrieval is being developed.
  • Output Data: Block output data is only available through the in-memory project cache. Use the ExecutionController workflow for actual data retrieval.
  • Best Practice: For complete block output, load the project, execute the notebook, and retrieve results via the Execution API.