ダッシュボード管理

ダッシュボードの一覧取得と取得

プロセスマイニングのインサイト、KPI、分析のための可視化パネルを含むダッシュボードにアクセスします。ダッシュボードは、分析結果を整理された共有可能な形式で表示するコンテナです。

接続テスト

未認証ピン

GET /api/{tenantId}/{projectId}/dashboard/unauthorized-ping

認証を必要としないテストエンドポイントです。Dashboard APIがアクセス可能かどうかを確認するために使用します。

レスポンス

Ping Successful

認証済みピン

GET /api/{tenantId}/{projectId}/dashboard/ping

特定のテナントおよびプロジェクトに対してAPIアクセスを検証する認証済みのピンエンドポイントです。

レスポンス (200 OK)

Ping Successful (tenant id: {tenantId})

レスポンス (401 Unauthorized)

{error message describing authorization failure}

すべてのダッシュボード一覧取得

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

指定されたプロジェクト内のすべてのダッシュボードのページネーションされたリストを取得します。各ダッシュボードにはメタデータ、パネル数、共有可能なURLが含まれます。

パスパラメータ

パラメータ タイプ 必須 説明
tenantId GUID はい テナント識別子
projectId GUID はい プロジェクト識別子

クエリパラメータ

パラメータ タイプ デフォルト 説明
page integer 1 ページネーションのページ番号
pageSize integer 50 1ページあたりの項目数(最大推奨:100)

レスポンス (200 OK)

{
  "dashboards": [
    {
      "dashboardId": "880e8400-e29b-41d4-a716-446655440000",
      "projectId": "660e8400-e29b-41d4-a716-446655440000",
      "name": "Process Overview Dashboard",
      "description": "Main dashboard showing key process metrics",
      "panelCount": 8,
      "url": "https://your-instance.com/dashboard/880e8400-e29b-41d4-a716-446655440000",
      "dateCreated": "2024-01-15T10:30:00Z",
      "dateModified": "2024-01-20T14:45:00Z",
      "createdBy": "user@example.com",
      "modifiedBy": "user@example.com"
    }
  ],
  "totalCount": 25,
  "page": 1,
  "pageSize": 50
}

レスポンスフィールド

フィールド タイプ 説明
dashboards 配列 ダッシュボードオブジェクトのリスト
totalCount 整数 ダッシュボードの合計数
page 整数 現在のページ番号
pageSize 整数 1ページあたりの項目数

ダッシュボードオブジェクトフィールド

フィールド タイプ 説明
dashboardId GUID ダッシュボードのユニーク識別子
projectId GUID このダッシュボードが属するプロジェクト
name 文字列 ダッシュボードの表示名
description 文字列 ダッシュボードの説明
panelCount 整数 ダッシュボード内のパネル数
url 文字列 共有可能なダッシュボードのURL
dateCreated 日時 ダッシュボード作成日時
dateModified 日時 ダッシュボード最終更新日時
createdBy 文字列 作成者ユーザー
modifiedBy 文字列 最終更新者ユーザー

ダッシュボード詳細取得

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

特定のダッシュボードに関する詳細情報(メタデータ、パネル数、共有可能URLなど)を取得します。

パスパラメータ

パラメータ タイプ 必須 説明
tenantId GUID はい テナント識別子
projectId GUID はい プロジェクト識別子
dashboardId GUID はい ダッシュボード識別子

レスポンス (200 OK)

{
  "dashboardId": "880e8400-e29b-41d4-a716-446655440000",
  "projectId": "660e8400-e29b-41d4-a716-446655440000",
  "name": "Process Overview Dashboard",
  "description": "Main dashboard showing key process metrics and performance indicators",
  "panelCount": 8,
  "url": "https://your-instance.com/dashboard/880e8400-e29b-41d4-a716-446655440000",
  "dateCreated": "2024-01-15T10:30:00Z",
  "dateModified": "2024-01-20T14:45:00Z",
  "createdBy": "user@example.com",
  "modifiedBy": "user@example.com"
}

エラー応答

Not Found (404):

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

ダッシュボードの作成

ダッシュボードの作成は、調査コンテキストおよびノートブックの関連付けが必要なため、mindzieStudioのUIを通じて管理されます。詳細はダッシュボード概要を参照してください。

実装例

cURL

# 接続テスト(認証なし)
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/dashboard/unauthorized-ping"

# 接続テスト(認証あり)
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/dashboard/ping" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# すべてのダッシュボード一覧取得
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/dashboard?page=1&pageSize=50" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# 特定ダッシュボード取得
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" \
  -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 DashboardManager {
  constructor(token) {
    this.headers = {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    };
  }

  async getAllDashboards(page = 1, pageSize = 50) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/dashboard?page=${page}&pageSize=${pageSize}`;
    const response = await fetch(url, { headers: this.headers });
    return await response.json();
  }

  async getDashboard(dashboardId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/dashboard/${dashboardId}`;
    const response = await fetch(url, { headers: this.headers });

    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 dashboard: ${response.status}`);
    }
  }

  async listAllDashboards() {
    const allDashboards = [];
    let page = 1;

    while (true) {
      const result = await this.getAllDashboards(page);
      allDashboards.push(...result.dashboards);

      if (allDashboards.length >= result.totalCount) {
        break;
      }
      page++;
    }

    return allDashboards;
  }
}

// Usage
const manager = new DashboardManager('your-auth-token');

// Get all dashboards
const result = await manager.getAllDashboards();
console.log(`Found ${result.totalCount} dashboards`);

result.dashboards.forEach(d => {
  console.log(`- ${d.name}: ${d.panelCount} panels`);
  console.log(`  URL: ${d.url}`);
});

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 DashboardManager:
    def __init__(self, token):
        self.headers = {
            'Authorization': f'Bearer {token}',
            'Content-Type': 'application/json'
        }

    def get_all_dashboards(self, page=1, page_size=50):
        """ページネーションされたダッシュボードのリストを取得します。"""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/dashboard'
        params = {'page': page, 'pageSize': page_size}
        response = requests.get(url, headers=self.headers, params=params)
        return response.json()

    def get_dashboard(self, dashboard_id):
        """ダッシュボードの詳細を取得します。"""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/dashboard/{dashboard_id}'
        response = requests.get(url, headers=self.headers)

        if response.ok:
            return response.json()
        elif response.status_code == 404:
            raise Exception('Dashboard not found')
        else:
            raise Exception(f'Failed to get dashboard: {response.status_code}')

    def list_all_dashboards(self):
        """すべてのダッシュボードを取得します(ページネーション処理付き)。"""
        all_dashboards = []
        page = 1

        while True:
            result = self.get_all_dashboards(page=page)
            all_dashboards.extend(result['dashboards'])

            if len(all_dashboards) >= result['totalCount']:
                break
            page += 1

        return all_dashboards

# 利用例
manager = DashboardManager('your-auth-token')

# すべてのダッシュボード取得
dashboards = manager.get_all_dashboards()
print(f"Total dashboards: {dashboards['totalCount']}")

for dashboard in dashboards['dashboards']:
    print(f"\nDashboard: {dashboard['name']}")
    print(f"  Panels: {dashboard['panelCount']}")
    print(f"  URL: {dashboard['url']}")

C#

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;

public class DashboardListReturn
{
    public List<DashboardReturn> Dashboards { get; set; }
    public int TotalCount { get; set; }
    public int Page { get; set; }
    public int PageSize { get; set; }
}

public class DashboardReturn
{
    public Guid DashboardId { get; set; }
    public Guid ProjectId { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public int PanelCount { get; set; }
    public string Url { get; set; }
    public DateTime DateCreated { get; set; }
    public DateTime DateModified { get; set; }
    public string CreatedBy { get; set; }
    public string ModifiedBy { get; set; }
}

public class DashboardApiClient
{
    private readonly HttpClient _httpClient;
    private readonly string _baseUrl;
    private readonly Guid _tenantId;
    private readonly Guid _projectId;

    public DashboardApiClient(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<DashboardListReturn> GetAllDashboardsAsync(int page = 1, int pageSize = 50)
    {
        var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/dashboard?page={page}&pageSize={pageSize}";
        var response = await _httpClient.GetAsync(url);

        if (response.IsSuccessStatusCode)
        {
            var json = await response.Content.ReadAsStringAsync();
            return JsonSerializer.Deserialize<DashboardListReturn>(json,
                new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
        }

        throw new Exception($"Failed to get dashboards: {response.StatusCode}");
    }

    public async Task<DashboardReturn> GetDashboardAsync(Guid dashboardId)
    {
        var url = $"{_baseUrl}/api/{_tenantId}/{_projectId}/dashboard/{dashboardId}";
        var response = await _httpClient.GetAsync(url);

        if (response.IsSuccessStatusCode)
        {
            var json = await response.Content.ReadAsStringAsync();
            return JsonSerializer.Deserialize<DashboardReturn>(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 dashboard: {response.StatusCode}");
    }
}