Sharing & URLs

Generate Shareable Dashboard URLs

Generate shareable links and embed URLs for dashboard access. Share dashboards with stakeholders or embed them in external applications.

Get Dashboard URLs

GET /api/{tenantId}/{projectId}/dashboard/{dashboardId}/url

Generates shareable URLs for a dashboard, including standard view URLs and embed URLs for iframe integration.

Path Parameters

Parameter Type Required Description
tenantId GUID Yes The tenant identifier
projectId GUID Yes The project identifier
dashboardId GUID Yes The dashboard identifier

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 Fields

Field Type Description
dashboardId GUID The dashboard identifier
url string Standard dashboard URL (requires authentication)
embedUrl string Embed URL for iframe integration

Error Responses

Not Found (404):

{
  "Error": "Dashboard not found",
  "DashboardId": "880e8400-e29b-41d4-a716-446655440000"
}

Dashboard Embedding

mindzieStudio dashboards can be embedded in external applications using iframe technology.

Basic Embedding

<iframe
  src="https://your-instance.com/embed/dashboard/880e8400-e29b-41d4-a716-446655440000"
  width="100%"
  height="600"
  frameborder="0"
  allowfullscreen>
</iframe>

Responsive 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

Standard URL

The standard dashboard URL requires user authentication:

  • Users must log in to mindzieStudio to view the dashboard
  • Provides full dashboard interactivity
  • Suitable for internal team sharing

Embed URL

The embed URL is designed for iframe integration:

  • Simplified interface optimized for embedding
  • May require additional authentication configuration
  • Suitable for portals and external applications

Implementation Examples

cURL

# Get dashboard URLs
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}`);
  }
}

// Generate embed code
function generateEmbedCode(embedUrl, width = '100%', height = 600) {
  return `<iframe
  src="${embedUrl}"
  width="${width}"
  height="${height}"
  frameborder="0"
  allowfullscreen>
</iframe>`;
}

// Usage
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):
    """Get shareable URLs for a 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):
    """Generate HTML embed code for a dashboard."""
    return f'''<iframe
  src="{embed_url}"
  width="{width}"
  height="{height}"
  frameborder="0"
  allowfullscreen>
</iframe>'''

# Usage
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>";
    }
}

// Usage
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

  • Authentication: Standard URLs require user authentication. Plan your sharing strategy accordingly.
  • Embedding: Use embed URLs when integrating dashboards into external applications or portals.
  • Responsive Design: Use responsive iframe techniques for mobile-friendly embedding.
  • Security: Consider your organization's security policies when sharing dashboard URLs externally.

Important Notes

  • Authentication Required: Both URL types may require authentication depending on your security configuration.
  • Access Control: Users accessing shared URLs must have appropriate permissions for the tenant and project.
  • Public Sharing: Extended public sharing features (password protection, expiration, etc.) are managed through the mindzieStudio UI.