Paylaşım & URL'ler
Paylaşılabilir Dashboard URL'leri Oluşturma
Dashboard erişimi için paylaşılabilir bağlantılar ve gömme URL'leri oluşturun. Dashboardları paydaşlarla paylaşın veya harici uygulamalara gömün.
Dashboard URL'lerini Alma
GET /api/{tenantId}/{projectId}/dashboard/{dashboardId}/url
Bir dashboard için standart görüntüleme URL'leri ve iframe entegrasyonu için gömme URL'leri dahil olmak üzere paylaşılabilir URL'ler oluşturur.
Yol Parametreleri
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
tenantId |
GUID | Evet | Kiracı tanımlayıcısı |
projectId |
GUID | Evet | Proje tanımlayıcısı |
dashboardId |
GUID | Evet | Dashboard tanımlayıcısı |
Yanıt (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"
}
Yanıt Alanları
| Alan | Tür | Açıklama |
|---|---|---|
dashboardId |
GUID | Dashboard tanımlayıcısı |
url |
string | Standart dashboard URL'si (kimlik doğrulama gerektirir) |
embedUrl |
string | Iframe entegrasyonu için gömme URL'si |
Hata Yanıtları
Bulunamadı (404):
{
"Error": "Dashboard bulunamadı",
"DashboardId": "880e8400-e29b-41d4-a716-446655440000"
}
Dashboard Gömme
mindzieStudio dashboardları, iframe teknolojisi kullanılarak harici uygulamalara gömülebilir.
Temel Gömme
<iframe
src="https://your-instance.com/embed/dashboard/880e8400-e29b-41d4-a716-446655440000"
width="100%"
height="600"
frameborder="0"
allowfullscreen>
</iframe>
Duyarlı Gömme
<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 Türleri
Standart URL
Standart dashboard URL'si kullanıcı kimlik doğrulaması gerektirir:
- Dashboardı görüntülemek için kullanıcıların mindzieStudio'ya giriş yapması gerekir
- Tam dashboard etkileşim sunar
- Dahili ekip paylaşımı için uygundur
Gömme URL
Gömme URL'si iframe entegrasyonu için tasarlanmıştır:
- Gömme için optimize edilmiş sadeleştirilmiş arayüz
- Ek kimlik doğrulama yapılandırması gerekebilir
- Portal ve harici uygulamalar için uygundur
Uygulama Örnekleri
cURL
# Dashboard URL'lerini al
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 bulunamadı');
} else {
throw new Error(`URL'ler alınamadı: ${response.status}`);
}
}
// Gömme kodu oluşturma
function generateEmbedCode(embedUrl, width = '100%', height = 600) {
return `<iframe
src="${embedUrl}"
width="${width}"
height="${height}"
frameborder="0"
allowfullscreen>
</iframe>`;
}
// Kullanım
const urls = await getDashboardUrls('dashboard-guid', 'your-auth-token');
console.log(`Dashboard URL: ${urls.url}`);
console.log(`Gömme URL: ${urls.embedUrl}`);
console.log('\nGömme kodu:');
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):
"""Dashboard için paylaşılabilir URL'leri al."""
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 bulunamadı')
else:
raise Exception(f'URL'ler alınamadı: {response.status_code}')
def generate_embed_code(embed_url, width='100%', height=600):
"""Dashboard için HTML gömme kodu oluştur."""
return f'''<iframe
src="{embed_url}"
width="{width}"
height="{height}"
frameborder="0"
allowfullscreen>
</iframe>'''
# Kullanım
urls = get_dashboard_urls('dashboard-guid', 'your-auth-token')
print(f"Dashboard URL: {urls['url']}")
print(f"Gömme URL: {urls['embedUrl']}")
print('\nGömme kodu:')
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} bulunamadı");
}
throw new Exception($"URL'ler alınamadı: {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>";
}
}
// Kullanım
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($"Gömme URL: {urls.EmbedUrl}");
Console.WriteLine("\nGömme kodu:");
Console.WriteLine(client.GenerateEmbedCode(urls.EmbedUrl));
En İyi Uygulamalar
- Kimlik Doğrulama: Standart URL'ler kullanıcı kimlik doğrulaması gerektirir. Paylaşım stratejinizi buna göre planlayın.
- Gömme: Dashboardları harici uygulamalara veya portallara entegre ederken gömme URL'lerini kullanın.
- Duyarlı Tasarım: Mobil uyumlu gömme için duyarlı iframe tekniklerini kullanın.
- Güvenlik: Dashboard URL'lerini harici paylaşırken kurumunuzun güvenlik politikalarını dikkate alın.
Önemli Notlar
- Kimlik Doğrulama Gerekiyor: Her iki URL türü de güvenlik yapılandırmanıza bağlı olarak kimlik doğrulama gerektirebilir.
- Erişim Kontrolü: Paylaşılan URL'lere erişen kullanıcıların ilgili tenant ve proje için uygun izinlere sahip olması gerekir.
- Genel Paylaşım: Şifre koruması, geçerlilik süresi gibi genişletilmiş genel paylaşım özellikleri mindzieStudio UI üzerinden yönetilir.