Delen & URL's
Genereer Deelbare Dashboard-URL's
Genereer deelbare links en embed-URL's voor toegang tot dashboards. Deel dashboards met belanghebbenden of embed ze in externe applicaties.
Verkrijg Dashboard-URL's
GET /api/{tenantId}/{projectId}/dashboard/{dashboardId}/url
Genereert deelbare URL's voor een dashboard, inclusief standaard view-URL's en embed-URL's voor iframe-integratie.
Padparameters
| Parameter | Type | Verplicht | Beschrijving |
|---|---|---|---|
tenantId |
GUID | Ja | De tenant-identificatie |
projectId |
GUID | Ja | De projectidentificatie |
dashboardId |
GUID | Ja | De dashboardidentificatie |
Response (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"
}
Response Velden
| Veld | Type | Beschrijving |
|---|---|---|
dashboardId |
GUID | De dashboardidentificatie |
url |
string | Standaard dashboard-URL (vereist authenticatie) |
embedUrl |
string | Embed-URL voor iframe-integratie |
Foutresponses
Niet gevonden (404):
{
"Error": "Dashboard not found",
"DashboardId": "880e8400-e29b-41d4-a716-446655440000"
}
Dashboard Embedding
mindzieStudio dashboards kunnen worden ingebed in externe applicaties met behulp van iframe-technologie.
Basis Embedding
<iframe
src="https://your-instance.com/embed/dashboard/880e8400-e29b-41d4-a716-446655440000"
width="100%"
height="600"
frameborder="0"
allowfullscreen>
</iframe>
Responsieve Embedding
<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-types
Standaard URL
De standaard dashboard-URL vereist gebruikersauthenticatie:
- Gebruikers moeten inloggen bij mindzieStudio om het dashboard te bekijken
- Biedt volledige dashboard-interactiviteit
- Geschikt voor intern delen binnen teams
Embed URL
De embed-URL is bedoeld voor iframe-integratie:
- Vereenvoudigde interface, geoptimaliseerd voor embedden
- Kan aanvullende authenticatieconfiguratie vereisen
- Geschikt voor portals en externe applicaties
Implementatievoorbeelden
cURL
# Verkrijg dashboard-URL's
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 not found');
} else {
throw new Error(`Failed to get URLs: ${response.status}`);
}
}
// Genereer embed-code
function generateEmbedCode(embedUrl, width = '100%', height = 600) {
return `<iframe
src="${embedUrl}"
width="${width}"
height="${height}"
frameborder="0"
allowfullscreen>
</iframe>`;
}
// Gebruik
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):
"""Verkrijg deelbare URL's voor een dashboard."""
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 not found')
else:
raise Exception(f'Failed to get URLs: {response.status_code}')
def generate_embed_code(embed_url, width='100%', height=600):
"""Genereer HTML-embed-code voor een dashboard."""
return f'''<iframe
src="{embed_url}"
width="{width}"
height="{height}"
frameborder="0"
allowfullscreen>
</iframe>'''
# Gebruik
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} not found");
}
throw new Exception($"Failed to get 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>";
}
}
// Gebruik
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
- Authenticatie: Standaard URL's vereisen gebruikersauthenticatie. Plan je deelstrategie hierop af.
- Embedding: Gebruik embed-URL's bij het integreren van dashboards in externe applicaties of portals.
- Responsief ontwerp: Gebruik responsieve iframe-technieken voor mobielvriendelijke embedding.
- Beveiliging: Houd rekening met het beveiligingsbeleid van je organisatie bij het extern delen van dashboard-URL's.
Belangrijke Opmerkingen
- Authenticatie vereist: Beide URL-types kunnen authenticatie vereisen, afhankelijk van je beveiligingsconfiguratie.
- Toegangscontrole: Gebruikers die gedeelde URL's openen, moeten de juiste rechten hebben voor de tenant en het project.
- Publiek delen: Uitgebreide functies voor openbaar delen (wachtwoordbeveiliging, vervaldatum, enz.) worden beheerd via de mindzieStudio UI.