Blockverwaltung
Analyseblöcke abrufen, aktualisieren und löschen
Verwalten Sie Analyseblöcke innerhalb von Notebooks. Blöcke sind die grundlegenden Analyseeinheiten, die Datenumwandlungen, Berechnungen, Filteroperationen und Benachrichtigungen durchführen.
Verbindungstests
Nicht autorisierter Ping
GET /api/{tenantId}/{projectId}/block/unauthorized-ping
Test-Endpunkt, der keine Authentifizierung erfordert. Verwenden Sie diesen, um zu überprüfen, ob die Block-API erreichbar ist.
Antwort
Ping Successful
Authentifizierter Ping
GET /api/{tenantId}/{projectId}/block/ping
Authentifizierter Ping-Endpunkt zur Überprüfung des API-Zugriffs für einen bestimmten Mandanten und ein Projekt.
Antwort (200 OK)
Ping Successful (tenant id: {tenantId})
Antwort (401 Unauthorized)
{error message describing authorization failure}
Blockdetails abrufen
GET /api/{tenantId}/{projectId}/block/{blockId}
Ruft umfassende Informationen zu einem bestimmten Analyseblock ab, einschließlich seiner Konfiguration, Ausführungshistorie und Metadaten.
Pfadparameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
tenantId |
GUID | Ja | Die Mandanten-ID |
projectId |
GUID | Ja | Die Projekt-ID |
blockId |
GUID | Ja | Die Block-ID |
Antwort (200 OK)
{
"blockId": "550e8400-e29b-41d4-a716-446655440000",
"notebookId": "660e8400-e29b-41d4-a716-446655440000",
"blockType": "Filter",
"blockTitle": "Datumsbereichsfilter",
"blockDescription": "Filtert Daten für die letzten 30 Tage",
"blockOrder": 0,
"configuration": "{\"filterType\": \"dateRange\", \"startDate\": \"2024-01-01\"}",
"isDisabled": false,
"dateCreated": "2024-01-15T10:30:00Z",
"dateModified": "2024-01-15T14:45:00Z",
"createdBy": "user@example.com",
"modifiedBy": "user@example.com",
"lastExecutionDate": "2024-01-15T14:45:00Z",
"lastExecutionStatus": "Success",
"executionCount": 12
}
Antwortfelder
| Feld | Typ | Beschreibung |
|---|---|---|
blockId |
GUID | Eindeutige Kennung des Blocks |
notebookId |
GUID | ID des Notebooks, das diesen Block enthält |
blockType |
string | Blocktyp (Filter, Rechner, Alert, etc.) |
blockTitle |
string | Anzeigetitel des Blocks |
blockDescription |
string | Beschreibung des Zwecks des Blocks |
blockOrder |
integer | Reihenfolge des Blocks im Notebook (Standard: 0) |
configuration |
string | JSON-String mit Blockeinstellungen |
isDisabled |
boolean | Ob der Block deaktiviert ist |
dateCreated |
datetime | Erstellungsdatum des Blocks |
dateModified |
datetime | Datum der letzten Änderung des Blocks |
createdBy |
string | Benutzer, der den Block erstellt hat |
modifiedBy |
string | Benutzer, der den Block zuletzt geändert hat |
lastExecutionDate |
datetime | Datum der letzten Ausführung |
lastExecutionStatus |
string | Status der letzten Ausführung |
executionCount |
integer | Anzahl der Ausführungen des Blocks |
Fehlermeldungen
Nicht gefunden (404):
{
"Error": "Block not found",
"BlockId": "550e8400-e29b-41d4-a716-446655440000"
}
Block aktualisieren
PUT /api/{tenantId}/{projectId}/block/{blockId}
Aktualisiert die Metadaten eines bestehenden Blocks. Die Ausführungshistorie bleibt erhalten, während die angegebenen Felder aktualisiert werden.
Anfragetext
{
"blockTitle": "Aktualisierter Datumsfilter",
"blockDescription": "Filtert Daten für benutzerdefinierten Datumsbereich",
"isDisabled": false
}
Anfragefelder
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
blockTitle |
string | Nein | Neuer Titel für den Block |
blockDescription |
string | Nein | Neue Beschreibung für den Block |
isDisabled |
boolean | Nein | Ob der Block deaktiviert werden soll |
Antwort (200 OK)
Gibt das aktualisierte Blockobjekt mit derselben Struktur wie beim GET-Endpunkt zurück.
Fehlermeldungen
Fehlerhafte Anfrage (400):
Failed to update block.
Block löschen
DELETE /api/{tenantId}/{projectId}/block/{blockId}
Entfernt einen Block und seine gesamte Ausführungshistorie dauerhaft aus dem Notebook. Diese Operation kann nicht rückgängig gemacht werden.
Antwortcodes
204 No Content- Block erfolgreich gelöscht400 Bad Request- Fehler beim Löschen des Blocks401 Unauthorized- Nicht authentifiziert oder kein Zugriff404 Not Found- Block nicht gefunden
Blöcke erstellen
Die Erstellung von Blöcken erfolgt über die Notebook-API, nicht über die Block-API.
POST /api/{tenantId}/{projectId}/notebook/{notebookId}/blocks
Siehe Notebook API für vollständige Dokumentation zur Blöckerstellung.
Implementierungsbeispiele
cURL
# Verbindung testen (ohne Auth)
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/block/unauthorized-ping"
# Verbindung testen (authentifiziert)
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/block/ping" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# Blockdetails abrufen
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" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
# Block aktualisieren
curl -X PUT "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/block/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"blockTitle": "Aktualisierter Filter", "isDisabled": false}'
# Block löschen
curl -X DELETE "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/block/550e8400-e29b-41d4-a716-446655440000" \
-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 BlockManager {
constructor(token) {
this.token = token;
this.headers = {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
};
}
async getBlock(blockId) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/block/${blockId}`;
const response = await fetch(url, { headers: this.headers });
if (response.ok) {
return await response.json();
} else if (response.status === 404) {
throw new Error('Block nicht gefunden');
} else {
throw new Error(`Fehler beim Abrufen des Blocks: ${response.status}`);
}
}
async updateBlock(blockId, updates) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/block/${blockId}`;
const response = await fetch(url, {
method: 'PUT',
headers: this.headers,
body: JSON.stringify(updates)
});
if (response.ok) {
return await response.json();
} else {
throw new Error(`Fehler beim Aktualisieren des Blocks: ${response.status}`);
}
}
async deleteBlock(blockId) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/block/${blockId}`;
const response = await fetch(url, {
method: 'DELETE',
headers: this.headers
});
return response.status === 204;
}
}
// Verwendung
const manager = new BlockManager('your-auth-token');
// Blockdetails abrufen
const block = await manager.getBlock('block-guid');
console.log(`Block: ${block.blockTitle} (${block.blockType})`);
// Block aktualisieren
const updated = await manager.updateBlock('block-guid', {
blockTitle: 'Aktualisierter Titel',
isDisabled: false
});
// Block löschen
const deleted = await manager.deleteBlock('block-guid');
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 BlockManager:
def __init__(self, token):
self.headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
def get_block(self, block_id):
"""Blockdetails abrufen."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/block/{block_id}'
response = requests.get(url, headers=self.headers)
if response.ok:
return response.json()
elif response.status_code == 404:
raise Exception('Block nicht gefunden')
else:
raise Exception(f'Fehler beim Abrufen des Blocks: {response.status_code}')
def update_block(self, block_id, title=None, description=None, disabled=None):
"""Block-Metadaten aktualisieren."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/block/{block_id}'
payload = {}
if title is not None:
payload['blockTitle'] = title
if description is not None:
payload['blockDescription'] = description
if disabled is not None:
payload['isDisabled'] = disabled
response = requests.put(url, json=payload, headers=self.headers)
if response.ok:
return response.json()
else:
raise Exception(f'Fehler beim Aktualisieren des Blocks: {response.status_code}')
def delete_block(self, block_id):
"""Block löschen."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/block/{block_id}'
response = requests.delete(url, headers=self.headers)
return response.status_code == 204
# Verwendung
manager = BlockManager('your-auth-token')
# Block abrufen
block = manager.get_block('block-guid')
print(f"Block: {block['blockTitle']} ({block['blockType']})")
print(f"Ausführungsanzahl: {block['executionCount']}")
# Block aktualisieren
updated = manager.update_block('block-guid', title='Neuer Titel', disabled=False)
print(f"Aktualisiert: {updated['blockTitle']}")
# Block löschen
if manager.delete_block('block-guid'):
print('Block erfolgreich gelöscht')
C#
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
public class BlockReturn
{
public Guid BlockId { get; set; }
public Guid NotebookId { get; set; }
public string BlockType { get; set; }
public string BlockTitle { get; set; }
public string BlockDescription { get; set; }
public int BlockOrder { get; set; }
public string Configuration { get; set; }
public bool IsDisabled { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateModified { get; set; }
public string CreatedBy { get; set; }
public string ModifiedBy { get; set; }
public DateTime? LastExecutionDate { get; set; }
public string LastExecutionStatus { get; set; }
public int ExecutionCount { get; set; }
}
public class BlockApiClient
{
private readonly HttpClient _httpClient;
private readonly string _baseUrl;
private readonly Guid _tenantId;
private readonly Guid _projectId;
public BlockApiClient(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<BlockReturn> GetBlockAsync(Guid blockId)
{
var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/block/{blockId}";
var response = await _httpClient.GetAsync(url);
if (response.IsSuccessStatusCode)
{
var json = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<BlockReturn>(json,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
throw new Exception($"Fehler beim Abrufen des Blocks: {response.StatusCode}");
}
public async Task<BlockReturn> UpdateBlockAsync(Guid blockId, string title, string description, bool? isDisabled)
{
var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/block/{blockId}";
var payload = new
{
blockTitle = title,
blockDescription = description,
isDisabled = isDisabled
};
var content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8,
"application/json");
var response = await _httpClient.PutAsync(url, content);
if (response.IsSuccessStatusCode)
{
var json = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<BlockReturn>(json,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
throw new Exception($"Fehler beim Aktualisieren des Blocks: {response.StatusCode}");
}
public async Task<bool> DeleteBlockAsync(Guid blockId)
{
var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/block/{blockId}";
var response = await _httpClient.DeleteAsync(url);
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
}
}