Defter Yönetimi

Soruşturmalar içinde defterleri yönetmek için tam CRUD işlemleri. Tüm değişiklik işlemleri projeyi otomatik olarak paylaşılan önbelleğe yükler.


Defterleri Listele

GET /api/{tenantId}/{projectId}/notebook/investigation/{investigationId}

Bir soruşturma içindeki tüm defterleri döner.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı tanımlayıcısı
projectId GUID Evet Proje tanımlayıcısı
investigationId GUID Evet Soruşturma tanımlayıcısı

Yanıt (200 OK)

[
  {
    "notebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    "investigationId": "11111111-2222-3333-4444-555555555555",
    "name": "Main",
    "description": "Primary analysis notebook",
    "dateCreated": "2024-01-15T10:30:00Z",
    "dateModified": "2024-01-20T14:45:00Z",
    "createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "modifiedBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "notebookType": 0,
    "notebookOrder": 1.0,
    "lastExecutionDuration": 2.5,
    "blockCount": 12
  },
  {
    "notebookId": "bbbbbbbb-cccc-dddd-eeee-ffffffffffff",
    "investigationId": "11111111-2222-3333-4444-555555555555",
    "name": "Variant Analysis",
    "description": "Process variant exploration",
    "dateCreated": "2024-01-16T09:00:00Z",
    "dateModified": "2024-01-18T11:30:00Z",
    "createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "modifiedBy": null,
    "notebookType": 0,
    "notebookOrder": 2.0,
    "lastExecutionDuration": 1.2,
    "blockCount": 8
  }
]

Hata Yanıtları

Bulunamadı (404)

{
  "Error": "Investigation not found",
  "InvestigationId": "11111111-2222-3333-4444-555555555555"
}

Defteri Getir

GET /api/{tenantId}/{projectId}/notebook/{notebookId}

Belirli bir deftere ait detaylı bilgileri döner.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı tanımlayıcısı
projectId GUID Evet Proje tanımlayıcısı
notebookId GUID Evet Defter tanımlayıcısı

Yanıt (200 OK)

{
  "notebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "investigationId": "11111111-2222-3333-4444-555555555555",
  "name": "Main",
  "description": "Primary analysis notebook",
  "dateCreated": "2024-01-15T10:30:00Z",
  "dateModified": "2024-01-20T14:45:00Z",
  "createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "modifiedBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "notebookType": 0,
  "notebookOrder": 1.0,
  "lastExecutionDuration": 2.5,
  "blockCount": 12
}

Defter Oluştur

POST /api/{tenantId}/{projectId}/notebook/investigation/{investigationId}

Soruşturma içinde yeni boş bir defter 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ı
investigationId GUID Evet Soruşturma tanımlayıcısı

İstek Gövdesi

{
  "name": "Process Analysis",
  "description": "Detailed process analysis workflow",
  "notebookType": 0
}

İstek Alanları

Alan Tür Zorunlu Açıklama
name string Evet Defter adı (soruşturma içinde benzersiz)
description string Hayır Defter açıklaması
notebookType integer Hayır Tür (0=Standart, varsayılan)

Yanıt (201 Created)

{
  "notebookId": "cccccccc-dddd-eeee-ffff-000000000000",
  "investigationId": "11111111-2222-3333-4444-555555555555",
  "name": "Process Analysis",
  "description": "Detailed process analysis workflow",
  "dateCreated": "2024-03-01T10:00:00Z",
  "dateModified": "2024-03-01T10:00:00Z",
  "createdBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "modifiedBy": null,
  "notebookType": 0,
  "notebookOrder": 3.0,
  "lastExecutionDuration": 0,
  "blockCount": 0
}

Hata Yanıtları

Kötü İstek (400)

{
  "Error": "Failed to create notebook. The name may already exist in this investigation."
}

Şablondan Oluştur

POST /api/{tenantId}/{projectId}/notebook/investigation/{investigationId}/from-template

Önceden tanımlanmış bir şablondan, tüm bloklar ve ayarları ile birlikte bir defter 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ı
investigationId GUID Evet Soruşturma tanımlayıcısı

İstek Gövdesi

{
  "templateId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "name": "Process Discovery Analysis",
  "description": "Analysis using Process Discovery template"
}

İstek Alanları

Alan Tür Zorunlu Açıklama
templateId GUID Evet Kullanılacak şablon
name string Hayır Şablon adını geçersiz kılma
description string Hayır Şablon açıklamasını geçersiz kılma

Yanıt (201 Created)

Şablondan oluşturulan blokları ile yeni defteri döner.

Hata Yanıtları

Bulunamadı (404)

{
  "Error": "Template not found"
}

Defteri Güncelle

PUT /api/{tenantId}/{projectId}/notebook/{notebookId}

Defter meta verilerini günceller. DateModified ile iyimser kilitleme (optimistic locking) desteklenir.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı tanımlayıcısı
projectId GUID Evet Proje tanımlayıcısı
notebookId GUID Evet Defter tanımlayıcısı

İstek Gövdesi

{
  "name": "Updated Notebook Name",
  "description": "Updated description",
  "notebookOrder": 2.5,
  "dateModified": "2024-01-20T14:45:00Z"
}

İstek Alanları

Alan Tür Zorunlu Açıklama
name string Evet Defter adı
description string Hayır Defter açıklaması
notebookOrder decimal Hayır Görüntüleme sırası
dateModified datetime Hayır İyimser kilitleme için

Yanıt (200 OK)

Güncellenmiş defteri döner.

İyimser Kilitleme

Eğer dateModified sağlanmış ve sunucudaki mevcut değerle eşleşmiyorsa, 409 Çakışma döner:

{
  "Error": "CONFLICT",
  "Message": "Notebook was modified by another user since you last fetched it",
  "YourDateModified": "2024-01-20T14:45:00Z",
  "CurrentDateModified": "2024-01-21T09:30:00Z",
  "ModifiedBy": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "Resolution": "GET /api/{tenantId}/{projectId}/notebook/{notebookId} to fetch current state, then retry"
}

Defteri Sil

DELETE /api/{tenantId}/{projectId}/notebook/{notebookId}

Bir defteri ve tüm bloklarını kalıcı olarak siler.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı tanımlayıcısı
projectId GUID Evet Proje tanımlayıcısı
notebookId GUID Evet Defter tanımlayıcısı

Yanıt (200 OK)

{
  "Message": "Notebook successfully deleted",
  "NotebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
}

Defteri Kopyala

POST /api/{tenantId}/{projectId}/notebook/{notebookId}/copy

Bir defterin tüm blokları ile birlikte tam kopyasını oluşturur. Aynı veya farklı bir soruşturmaya kopyalama yapılabilir.

Yol Parametreleri

Parametre Tür Zorunlu Açıklama
tenantId GUID Evet Kiracı tanımlayıcısı
projectId GUID Evet Proje tanımlayıcısı
notebookId GUID Evet Kaynak defter tanımlayıcısı

İstek Gövdesi

{
  "name": "Copy of Main Analysis",
  "destinationInvestigationId": "22222222-3333-4444-5555-666666666666"
}

İstek Alanları

Alan Tür Zorunlu Açıklama
name string Hayır Kopya için ad (varsayılan: "Copy of ")
destinationInvestigationId GUID Hayır Hedef soruşturma (varsayılan: aynı soruşturma)

Yanıt (201 Created)

Yeni oluşturulan defter kopyasını döner.


Paylaşılabilir URL Al

GET /api/{tenantId}/{projectId}/notebook/{notebookId}/url

Kullanıcı arayüzünde deftere doğrudan erişim için paylaşılabilir URL oluşturur.

Yanıt (200 OK)

{
  "notebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "url": "https://your-mindzie-instance.com/investigation/12345678/87654321/11111111/notebook/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "relativePath": "/investigation/12345678/87654321/11111111/notebook/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
  "expiresAt": null
}

Uygulama Örnekleri

Python

import requests

BASE_URL = 'https://your-mindzie-instance.com'
TENANT_ID = '12345678-1234-1234-1234-123456789012'
PROJECT_ID = '87654321-4321-4321-4321-210987654321'

class NotebookManager:
    def __init__(self, api_key):
        self.headers = {
            'Authorization': f'Bearer {api_key}',
            'Content-Type': 'application/json'
        }

    def list_notebooks(self, investigation_id):
        """Bir soruşturmadaki tüm defterleri listeler."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/investigation/{investigation_id}'
        response = requests.get(url, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def get_notebook(self, notebook_id):
        """Defter detaylarını getirir."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}'
        response = requests.get(url, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def create_notebook(self, investigation_id, name, description=None):
        """Yeni bir defter oluşturur."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/investigation/{investigation_id}'
        data = {'name': name, 'description': description}
        response = requests.post(url, json=data, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def create_from_template(self, investigation_id, template_id, name=None):
        """Şablondan defter oluşturur."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/investigation/{investigation_id}/from-template'
        data = {'templateId': template_id, 'name': name}
        response = requests.post(url, json=data, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def update_notebook(self, notebook_id, name, description=None, date_modified=None):
        """İyimser kilitleme ile defteri günceller."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}'
        data = {'name': name, 'description': description}
        if date_modified:
            data['dateModified'] = date_modified
        response = requests.put(url, json=data, headers=self.headers)
        if response.status_code == 409:
            conflict = response.json()
            raise Exception(f"Çakışma: {conflict['Message']}")
        response.raise_for_status()
        return response.json()

    def delete_notebook(self, notebook_id):
        """Bir defteri siler."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}'
        response = requests.delete(url, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def copy_notebook(self, notebook_id, name=None, destination_investigation=None):
        """Bir defteri kopyalar."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/notebook/{notebook_id}/copy'
        data = {'name': name}
        if destination_investigation:
            data['destinationInvestigationId'] = destination_investigation
        response = requests.post(url, json=data, headers=self.headers)
        response.raise_for_status()
        return response.json()

# Kullanım
manager = NotebookManager('your-api-key')
investigation_id = '11111111-2222-3333-4444-555555555555'

# Defterleri listele
notebooks = manager.list_notebooks(investigation_id)
print(f"{len(notebooks)} defter bulundu")

# Defter oluştur
notebook = manager.create_notebook(investigation_id, 'New Analysis', 'My workflow')
print(f"Defter oluşturuldu: {notebook['notebookId']}")

# Defteri kopyala
copy = manager.copy_notebook(notebook['notebookId'], 'Copy of New Analysis')
print(f"Kopya oluşturuldu: {copy['notebookId']}")

# İyimser kilitleme ile güncelle
try:
    updated = manager.update_notebook(
        notebook['notebookId'],
        'Renamed Analysis',
        date_modified=notebook['dateModified']
    )
except Exception as e:
    print(f"Güncelleme başarısız: {e}")

JavaScript/Node.js

const BASE_URL = 'https://your-mindzie-instance.com';
const TENANT_ID = '12345678-1234-1234-1234-123456789012';
const PROJECT_ID = '87654321-4321-4321-4321-210987654321';

class NotebookManager {
  constructor(apiKey) {
    this.headers = {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    };
  }

  async listNotebooks(investigationId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/investigation/${investigationId}`;
    const response = await fetch(url, { headers: this.headers });
    if (!response.ok) throw new Error(`Başarısız: ${response.status}`);
    return response.json();
  }

  async createNotebook(investigationId, name, description = null) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/investigation/${investigationId}`;
    const response = await fetch(url, {
      method: 'POST',
      headers: this.headers,
      body: JSON.stringify({ name, description })
    });
    if (!response.ok) throw new Error(`Başarısız: ${response.status}`);
    return response.json();
  }

  async updateNotebook(notebookId, name, description = null, dateModified = null) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/${notebookId}`;
    const body = { name, description };
    if (dateModified) body.dateModified = dateModified;

    const response = await fetch(url, {
      method: 'PUT',
      headers: this.headers,
      body: JSON.stringify(body)
    });

    if (response.status === 409) {
      const conflict = await response.json();
      throw new Error(`Çakışma: ${conflict.Message}`);
    }
    if (!response.ok) throw new Error(`Başarısız: ${response.status}`);
    return response.json();
  }

  async deleteNotebook(notebookId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/${notebookId}`;
    const response = await fetch(url, {
      method: 'DELETE',
      headers: this.headers
    });
    if (!response.ok) throw new Error(`Başarısız: ${response.status}`);
    return response.json();
  }

  async copyNotebook(notebookId, name = null, destinationInvestigationId = null) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/notebook/${notebookId}/copy`;
    const body = {};
    if (name) body.name = name;
    if (destinationInvestigationId) body.destinationInvestigationId = destinationInvestigationId;

    const response = await fetch(url, {
      method: 'POST',
      headers: this.headers,
      body: JSON.stringify(body)
    });
    if (!response.ok) throw new Error(`Başarısız: ${response.status}`);
    return response.json();
  }
}

// Kullanım
const manager = new NotebookManager('your-api-key');
const investigationId = '11111111-2222-3333-4444-555555555555';

// Defterleri listele
const notebooks = await manager.listNotebooks(investigationId);
console.log(`${notebooks.length} defter bulundu`);

// Oluştur ve kopyala
const notebook = await manager.createNotebook(investigationId, 'New Analysis');
const copy = await manager.copyNotebook(notebook.notebookId, 'Copy of Analysis');

En İyi Uygulamalar

  1. Otomatik Yükleme: Defter CRUD işlemleri için projeleri açıkça yüklemeyin - otomatik gerçekleşir
  2. İyimser Kilitleme: Çakışmaları algılamak için güncellemelerde dateModified alanını dahil edin
  3. Şablonlar: Tutarlı analiz iş akışları için şablonları kullanın
  4. Adlandırma: Her soruşturma içinde benzersiz, açıklayıcı isimler kullanın
  5. Temizlik: Kullanılmayan defterleri silerek soruşturmaları düzenli tutun