# APIs Mementos

Les Mementos permettent aux utilisateurs de définir des collections de documents qui peuvent être accessibles par des applications. Ce document décrit les APIs Memento disponibles.

## Liste des Mementos

{% openapi src="<https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media&token=9d0098e1-f392-4761-be64-ff6f2caad99e>" path="/mementos/" method="get" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET \
  https://api.rememberizer.ai/api/v1/mementos/ \
  -H "Authorization: Bearer VOTRE_JWT_TOKEN"
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `VOTRE_JWT_TOKEN` par votre véritable jeton JWT.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const fetchMementos = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/mementos/', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer VOTRE_JWT_TOKEN'
    }
  });
  
  const data = await response.json();
  console.log(data);
};

fetchMementos();
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `VOTRE_JWT_TOKEN` par votre véritable jeton JWT.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def fetch_mementos():
    headers = {
        "Authorization": "Bearer VOTRE_JWT_TOKEN"
    }
    
    response = requests.get(
        "https://api.rememberizer.ai/api/v1/mementos/",
        headers=headers
    )
    
    data = response.json()
    print(data)

fetch_mementos()
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `VOTRE_JWT_TOKEN` par votre véritable jeton JWT.
{% endhint %}
{% endtab %}
{% endtabs %}

## Créer un Memento

{% openapi src="<https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media&token=9d0098e1-f392-4761-be64-ff6f2caad99e>" path="/mementos/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de Requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/mementos/ \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Documents de Travail"}'
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const createMemento = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/mementos/', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Documents de Travail'
    })
  });
  
  const data = await response.json();
  console.log(data);
};

createMemento();
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def create_memento():
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN",
        "Content-Type": "application/json"
    }
    
    payload = {
        "name": "Documents de Travail"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/mementos/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    data = response.json()
    print(data)

create_memento()
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT.
{% endhint %}
{% endtab %}
{% endtabs %}

## Obtenir les détails du Memento

{% openapi src="<https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media&token=9d0098e1-f392-4761-be64-ff6f2caad99e>" path="/mementos/{id}/" method="get" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET \
  https://api.rememberizer.ai/api/v1/mementos/123/ \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et `123` par un ID de memento réel.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const getMementoDetails = async (mementoId) => {
  const response = await fetch(`https://api.rememberizer.ai/api/v1/mementos/${mementoId}/`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
  });
  
  const data = await response.json();
  console.log(data);
};

getMementoDetails(123);
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et `123` par un ID de memento réel.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def get_memento_details(memento_id):
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
    }
    
    response = requests.get(
        f"https://api.rememberizer.ai/api/v1/mementos/{memento_id}/",
        headers=headers
    )
    
    data = response.json()
    print(data)

get_memento_details(123)
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et `123` par un ID de memento réel.
{% endhint %}
{% endtab %}
{% endtabs %}

## Gérer les documents Memento

{% openapi src="<https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media&token=9d0098e1-f392-4761-be64-ff6f2caad99e>" path="/mementos/memento\_document/{memento\_id}/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de Requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/mementos/memento_document/123/ \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "memento": "123",
    "add": ["document_id_1", "document_id_2"],
    "folder_add": ["folder_id_1"],
    "remove": ["document_id_3"]
  }'
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et utilisez des identifiants de document et de dossier réels.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const manageMementoDocuments = async (mementoId) => {
  const response = await fetch(`https://api.rememberizer.ai/api/v1/mementos/memento_document/${mementoId}/`, {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      memento: mementoId,
      add: ["document_id_1", "document_id_2"],
      folder_add: ["folder_id_1"],
      remove: ["document_id_3"]
    })
  });
  
  const data = await response.json();
  console.log(data);
};

manageMementoDocuments(123);
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et utilisez des identifiants de document et de dossier réels.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def manage_memento_documents(memento_id):
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN",
        "Content-Type": "application/json"
    }
    
    payload = {
        "memento": memento_id,
        "add": ["document_id_1", "document_id_2"],
        "folder_add": ["folder_id_1"],
        "remove": ["document_id_3"]
    }
    
    response = requests.post(
        f"https://api.rememberizer.ai/api/v1/mementos/memento_document/{memento_id}/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    data = response.json()
    print(data)

manage_memento_documents(123)
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et utilisez des identifiants de document et de dossier réels.
{% endhint %}
{% endtab %}
{% endtabs %}

## Supprimer Memento

{% openapi src="<https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media&token=9d0098e1-f392-4761-be64-ff6f2caad99e>" path="/mementos/{id}/" method="delete" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de Requêtes

```bash
curl -X DELETE \
  https://api.rememberizer.ai/api/v1/mementos/123/ \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et `123` par un ID de memento réel.
{% endhint %}

```javascript
const deleteMemento = async (mementoId) => {
  const response = await fetch(`https://api.rememberizer.ai/api/v1/mementos/${mementoId}/`, {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
  });
  
  if (response.status === 204) {
    console.log("Memento supprimé avec succès");
  } else {
    console.error("Échec de la suppression du memento");
  }
};

deleteMemento(123);
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et `123` par un ID de memento réel.
{% endhint %}

```python
import requests

def delete_memento(memento_id):
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
    }
    
    response = requests.delete(
        f"https://api.rememberizer.ai/api/v1/mementos/{memento_id}/",
        headers=headers
    )
    
    if response.status_code == 204:
        print("Memento supprimé avec succès")
    else:
        print("Échec de la suppression du memento")

delete_memento(123)
```

{% hint style="info" %}
Pour tester cet appel API, remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et `123` par un ID de memento réel.
{% endhint %}

{% endtabs %
