Carnets d'Investigation

Accédez aux carnets au sein d'une investigation. Les carnets contiennent les blocs d'analyse qui définissent les flux de travail de fouille de processus.

Prérequis

Avant d'accéder aux carnets via cette API, vous devez charger le projet en cache en utilisant l'API Project.

# Charger d'abord le projet dans le cache
curl -X GET "https://your-mindzie-instance.com/api/{tenantId}/project/{projectId}/load" \
  -H "Authorization: Bearer YOUR_API_KEY"

Voir Project Cache API pour plus de détails.


Lister les Carnets d'Investigation

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

Récupère tous les carnets au sein d'une investigation depuis le cache du projet.

Paramètres de Chemin

Paramètre Type Obligatoire Description
tenantId GUID Oui L'identifiant du locataire
projectId GUID Oui L'identifiant du projet
investigationId GUID Oui L'identifiant de l'investigation

Réponse (200 OK)

{
  "notebooks": [
    {
      "notebookId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "investigationId": "11111111-2222-3333-4444-555555555555",
      "name": "Main",
      "description": "",
      "dateCreated": "2024-01-15T10:30:00Z",
      "dateModified": "2024-01-20T14:45:00Z",
      "createdBy": null,
      "modifiedBy": null,
      "notebookType": null,
      "notebookOrder": 1.0,
      "lastExecutionDuration": 0,
      "blockCount": 12
    },
    {
      "notebookId": "bbbbbbbb-cccc-dddd-eeee-ffffffffffff",
      "investigationId": "11111111-2222-3333-4444-555555555555",
      "name": "Variant Analysis",
      "description": "",
      "dateCreated": "2024-01-16T09:00:00Z",
      "dateModified": "2024-01-18T11:30:00Z",
      "createdBy": null,
      "modifiedBy": null,
      "notebookType": null,
      "notebookOrder": 2.0,
      "lastExecutionDuration": 0,
      "blockCount": 8
    }
  ],
  "totalCount": 2
}

Champs de l'Objet Carnet

Champ Type Description
notebookId GUID Identifiant unique du carnet
investigationId GUID Investigation à laquelle le carnet appartient
name string Nom affiché du carnet
description string Description du carnet
dateCreated datetime Date de création du carnet
dateModified datetime Date de dernière modification du carnet
createdBy GUID Utilisateur ayant créé le carnet
modifiedBy GUID Utilisateur ayant modifié le carnet en dernier
notebookType integer Type de carnet (0 = standard)
notebookOrder decimal Ordre d'affichage au sein de l'investigation
lastExecutionDuration double Durée de la dernière exécution en secondes
blockCount integer Nombre de blocs dans le carnet

Réponses d'Erreur

Non trouvé (404) - Projet non mis en cache :

"Project not found in cache. Please load the project first using the ProjectController.LoadProject endpoint."

Non trouvé (404) - Investigation non trouvée :

{
  "error": "Investigation not found",
  "investigationId": "11111111-2222-3333-4444-555555555555"
}

Obtenir le Carnet Principal

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

Récupère le carnet principal pour une investigation. Le carnet principal est automatiquement créé lors de la création de l'investigation et contient généralement le flux de travail principal de filtrage et d'analyse.

Paramètres de Chemin

Paramètre Type Obligatoire Description
tenantId GUID Oui L'identifiant du locataire
projectId GUID Oui L'identifiant du projet
investigationId GUID Oui L'identifiant de l'investigation

Réponse (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
}

Réponses d'Erreur

Non trouvé (404) - Investigation non trouvée :

{
  "error": "Investigation not found",
  "investigationId": "11111111-2222-3333-4444-555555555555"
}

Non trouvé (404) - Carnet principal non trouvé :

{
  "error": "Main notebook not found for investigation",
  "investigationId": "11111111-2222-3333-4444-555555555555"
}

Exemples d'Implémentation

cURL

# Étape 1 : Charger d'abord le projet dans le cache
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/project/87654321-4321-4321-4321-210987654321/load" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# Étape 2 : Lister tous les carnets d'une investigation
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/investigation/11111111-2222-3333-4444-555555555555/notebooks" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# Obtenir directement le carnet principal
curl -X GET "https://your-mindzie-instance.com/api/12345678-1234-1234-1234-123456789012/87654321-4321-4321-4321-210987654321/investigation/11111111-2222-3333-4444-555555555555/main-notebook" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

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

    def load_project(self):
        """Charger le projet dans le cache avant d'accéder aux carnets."""
        url = f'{BASE_URL}/api/{TENANT_ID}/project/{PROJECT_ID}/load'
        response = requests.get(url, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def list_notebooks(self, investigation_id):
        """Lister tous les carnets d'une investigation."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/investigation/{investigation_id}/notebooks'
        response = requests.get(url, headers=self.headers)
        response.raise_for_status()
        return response.json()

    def get_main_notebook(self, investigation_id):
        """Obtenir le carnet principal pour une investigation."""
        url = f'{BASE_URL}/api/{TENANT_ID}/{PROJECT_ID}/investigation/{investigation_id}/main-notebook'
        response = requests.get(url, headers=self.headers)
        response.raise_for_status()
        return response.json()

# Utilisation
accessor = NotebookAccessor('your-auth-token')
investigation_id = '11111111-2222-3333-4444-555555555555'

# Étape 1 : Charger le projet dans le cache
print("Chargement du projet dans le cache...")
load_result = accessor.load_project()
print(f"Projet chargé : {load_result['projectName']}")

# Étape 2 : Lister les carnets
notebooks = accessor.list_notebooks(investigation_id)
print(f"\n{notebooks['totalCount']} carnets trouvés :")

for nb in notebooks['notebooks']:
    print(f"  - {nb['name']} : {nb['blockCount']} blocs")

# Obtenir le carnet principal
main = accessor.get_main_notebook(investigation_id)
print(f"\nCarnet principal : {main['name']} ({main['blockCount']} blocs)")

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 NotebookAccessor {
  constructor(token) {
    this.headers = {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    };
  }

  async loadProject() {
    const url = `${BASE_URL}/api/${TENANT_ID}/project/${PROJECT_ID}/load`;
    const response = await fetch(url, { headers: this.headers });
    if (!response.ok) throw new Error(`Échec : ${response.status}`);
    return await response.json();
  }

  async listNotebooks(investigationId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/investigation/${investigationId}/notebooks`;
    const response = await fetch(url, { headers: this.headers });
    if (!response.ok) throw new Error(`Échec : ${response.status}`);
    return await response.json();
  }

  async getMainNotebook(investigationId) {
    const url = `${BASE_URL}/api/${TENANT_ID}/${PROJECT_ID}/investigation/${investigationId}/main-notebook`;
    const response = await fetch(url, { headers: this.headers });
    if (!response.ok) throw new Error(`Échec : ${response.status}`);
    return await response.json();
  }
}

// Utilisation
const accessor = new NotebookAccessor('your-auth-token');
const investigationId = '11111111-2222-3333-4444-555555555555';

// Étape 1 : Charger le projet
console.log('Chargement du projet dans le cache...');
const loadResult = await accessor.loadProject();
console.log(`Projet chargé : ${loadResult.projectName}`);

// Étape 2 : Lister les carnets
const notebooks = await accessor.listNotebooks(investigationId);
console.log(`\n${notebooks.totalCount} carnets trouvés :`);

notebooks.notebooks.forEach(nb => {
  console.log(`  - ${nb.name} : ${nb.blockCount} blocs`);
});

// Obtenir le carnet principal
const main = await accessor.getMainNotebook(investigationId);
console.log(`\nCarnet principal : ${main.name} (${main.blockCount} blocs)`);

Bonnes Pratiques

  1. Toujours Charger le Projet d'Abord : Avant d'accéder aux carnets, assurez-vous que le projet est chargé dans le cache
  2. Durée du Cache : Les projets restent en cache pendant 30 minutes après le dernier accès
  3. Prolonger la Session : Les appels API prolongent automatiquement la durée de vie du cache
  4. Utiliser le Carnet Principal : Pour une analyse de base, le carnet principal contient le flux de travail primaire
  5. Ordre des Carnets : Les carnets sont ordonnés par notebookOrder pour un affichage cohérent