Teilen & URLs
Generieren von teilbaren Dashboard-URLs
Erstellen Sie teilbare Links und Embed-URLs für den Zugriff auf Dashboards. Teilen Sie Dashboards mit Stakeholdern oder betten Sie sie in externe Anwendungen ein.
Dashboard-URLs abrufen
GET /api/{tenantId}/{projectId}/dashboard/{dashboardId}/url
Generiert teilbare URLs für ein Dashboard, einschließlich Standard-Ansichts-URLs und Embed-URLs für die Integration in iframes.
Pfadparameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
tenantId |
GUID | Ja | Die Mandanten-ID |
projectId |
GUID | Ja | Die Projekt-ID |
dashboardId |
GUID | Ja | Die Dashboard-ID |
Antwort (200 OK)
{
"dashboardId": "880e8400-e29b-41d4-a716-446655440000",
"url": "https://your-instance.com/dashboard/880e8400-e29b-41d4-a716-446655440000",
"embedUrl": "https://your-instance.com/embed/dashboard/880e8400-e29b-41d4-a716-446655440000"
}
Antwortfelder
| Feld | Typ | Beschreibung |
|---|---|---|
dashboardId |
GUID | Die Dashboard-ID |
url |
string | Standard-Dashboard-URL (Authentifizierung erforderlich) |
embedUrl |
string | Embed-URL für iframe-Integration |
Fehlerantworten
Nicht gefunden (404):
{
"Error": "Dashboard not found",
"DashboardId": "880e8400-e29b-41d4-a716-446655440000"
}
Dashboard-Einbettung
mindzieStudio Dashboards können mit iframes in externe Anwendungen eingebettet werden.
Einfache Einbettung
<iframe
src="https://your-instance.com/embed/dashboard/880e8400-e29b-41d4-a716-446655440000"
width="100%"
height="600"
frameborder="0"
allowfullscreen>
</iframe>
Responsive Einbettung
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
<iframe
src="https://your-instance.com/embed/dashboard/880e8400-e29b-41d4-a716-446655440000"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
frameborder="0"
allowfullscreen>
</iframe>
</div>
URL-Typen
Standard URL
Die Standard-Dashboard-URL erfordert eine Benutzer-Authentifizierung:
- Benutzer müssen sich bei mindzieStudio anmelden, um das Dashboard anzeigen zu können
- Bietet volle Interaktivität des Dashboards
- Geeignet für internes Teilen im Team
Embed URL
Die Embed-URL ist für die Integration in iframes ausgelegt:
- Vereinfachte Oberfläche, optimiert für die Einbettung
- Kann zusätzliche Authentifizierungskonfiguration erfordern
- Geeignet für Portale und externe Anwendungen
Implementierungsbeispiele
cURL
# Dashboard-URLs abrufen
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/dashboard/880e8400-e29b-41d4-a716-446655440000/url" \
-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';
async function getDashboardUrls(dashboardId, token) {
const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/dashboard/${dashboardId}/url`;
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
});
if (response.ok) {
return await response.json();
} else if (response.status === 404) {
throw new Error('Dashboard nicht gefunden');
} else {
throw new Error(`Fehler beim Abrufen der URLs: ${response.status}`);
}
}
// Embed-Code generieren
function generateEmbedCode(embedUrl, width = '100%', height = 600) {
return `<iframe
src="${embedUrl}"
width="${width}"
height="${height}"
frameborder="0"
allowfullscreen>
</iframe>`;
}
// Verwendung
const urls = await getDashboardUrls('dashboard-guid', 'your-auth-token');
console.log(`Dashboard URL: ${urls.url}`);
console.log(`Embed URL: ${urls.embedUrl}`);
console.log('\nEmbed-Code:');
console.log(generateEmbedCode(urls.embedUrl));
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_dashboard_urls(dashboard_id, token):
"""Teilenbare URLs für ein Dashboard abrufen."""
url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/dashboard/{dashboard_id}/url'
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
if response.ok:
return response.json()
elif response.status_code == 404:
raise Exception('Dashboard nicht gefunden')
else:
raise Exception(f'Fehler beim Abrufen der URLs: {response.status_code}')
def generate_embed_code(embed_url, width='100%', height=600):
"""HTML-Embed-Code für ein Dashboard generieren."""
return f'''<iframe
src="{embed_url}"
width="{width}"
height="{height}"
frameborder="0"
allowfullscreen>
</iframe>'''
# Verwendung
urls = get_dashboard_urls('dashboard-guid', 'your-auth-token')
print(f"Dashboard URL: {urls['url']}")
print(f"Embed URL: {urls['embedUrl']}")
print('\nEmbed-Code:')
print(generate_embed_code(urls['embedUrl']))
C#
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
public class DashboardUrlResponse
{
public Guid DashboardId { get; set; }
public string Url { get; set; }
public string EmbedUrl { get; set; }
}
public class DashboardSharingClient
{
private readonly HttpClient _httpClient;
private readonly string _baseUrl;
private readonly Guid _tenantId;
private readonly Guid _projectId;
public DashboardSharingClient(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<DashboardUrlResponse> GetDashboardUrlsAsync(Guid dashboardId)
{
var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/dashboard/{dashboardId}/url";
var response = await _httpClient.GetAsync(url);
if (response.IsSuccessStatusCode)
{
var json = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<DashboardUrlResponse>(json,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
}
else if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
{
throw new Exception($"Dashboard {dashboardId} nicht gefunden");
}
throw new Exception($"Fehler beim Abrufen der URLs: {response.StatusCode}");
}
public string GenerateEmbedCode(string embedUrl, string width = "100%", int height = 600)
{
return $@"<iframe
src=""{embedUrl}""
width=""{width}""
height=""{height}""
frameborder=""0""
allowfullscreen>
</iframe>";
}
}
// Verwendung
var client = new DashboardSharingClient(
"https://your-mindzie-instance.com",
Guid.Parse("12345678-1234-1234-1234-123456789012"),
Guid.Parse("87654321-4321-4321-4321-210987654321"),
"your-access-token");
var urls = await client.GetDashboardUrlsAsync(Guid.Parse("dashboard-guid"));
Console.WriteLine($"Dashboard URL: {urls.Url}");
Console.WriteLine($"Embed URL: {urls.EmbedUrl}");
Console.WriteLine("\nEmbed-Code:");
Console.WriteLine(client.GenerateEmbedCode(urls.EmbedUrl));
Best Practices
- Authentifizierung: Standard-URLs erfordern eine Benutzer-Authentifizierung. Planen Sie Ihre Sharing-Strategie entsprechend.
- Einbettung: Verwenden Sie Embed-URLs, wenn Sie Dashboards in externe Anwendungen oder Portale integrieren.
- Responsives Design: Nutzen Sie responsive iframe-Techniken für mobilfreundliche Einbettungen.
- Sicherheit: Berücksichtigen Sie die Sicherheitsrichtlinien Ihrer Organisation beim Teilen von Dashboard-URLs extern.
Wichtige Hinweise
- Authentifizierung erforderlich: Beide URL-Typen können je nach Sicherheitskonfiguration eine Authentifizierung erfordern.
- Zugriffskontrolle: Benutzer, die geteilte URLs verwenden, müssen über geeignete Berechtigungen für Mandant und Projekt verfügen.
- Öffentliches Teilen: Erweiterte öffentliche Freigabefunktionen (Passwortschutz, Ablaufdatum usw.) werden über die mindzieStudio-Benutzeroberfläche verwaltet.