# API Mementos

Mementos cho phép người dùng định nghĩa các bộ sưu tập tài liệu có thể được truy cập bởi các ứng dụng. Tài liệu này phác thảo các API Memento có sẵn.

## Danh sách Memento

{% openapi src="/files/uCR2Hrq9CjDxpCLaqzhl" path="/mementos/" method="get" %}
[rememberizer\_openapi.yml](https://4187618229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwbxu0T4faQnPtKbPzrD5%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=b77a395b-ed7b-4546-9ec7-182d4939fd1b)
{% endopenapi %}

### Ví dụ Yêu cầu

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

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

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% 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 YOUR_JWT_TOKEN'
    }
  });
  
  const data = await response.json();
  console.log(data);
};

fetchMementos();
```

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

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

fetch_mementos()
```

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% endhint %}
{% endtab %}
{% endtabs %}

## Tạo Memento

{% openapi src="/files/uCR2Hrq9CjDxpCLaqzhl" path="/mementos/" method="post" %}
[rememberizer\_openapi.yml](https://4187618229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwbxu0T4faQnPtKbPzrD5%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=b77a395b-ed7b-4546-9ec7-182d4939fd1b)
{% endopenapi %}

### Ví dụ Yêu Cầu

{% 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": "Tài liệu Công việc"}'
```

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% 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: 'Tài liệu Công việc'
    })
  });
  
  const data = await response.json();
  console.log(data);
};

createMemento();
```

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% 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": "Tài liệu Công việc"
    }
    
    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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% endhint %}
{% endtab %}
{% endtabs %}

## Lấy Chi Tiết Memento

{% openapi src="/files/uCR2Hrq9CjDxpCLaqzhl" path="/mementos/{id}/" method="get" %}
[rememberizer\_openapi.yml](https://4187618229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwbxu0T4faQnPtKbPzrD5%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=b77a395b-ed7b-4546-9ec7-182d4939fd1b)
{% endopenapi %}

### Ví dụ Yêu cầu

{% 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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `123` bằng ID memento thực tế.
{% 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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `123` bằng ID memento thực tế.
{% 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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `123` bằng ID memento thực tế.
{% endhint %}
{% endtab %}
{% endtabs %}

## Quản lý Tài liệu Memento

{% openapi src="/files/uCR2Hrq9CjDxpCLaqzhl" path="/mementos/memento\_document/{memento\_id}/" method="post" %}
[rememberizer\_openapi.yml](https://4187618229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwbxu0T4faQnPtKbPzrD5%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=b77a395b-ed7b-4546-9ec7-182d4939fd1b)
{% endopenapi %}

### Ví dụ Yêu cầu

{% 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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và sử dụng các ID tài liệu và thư mục thực tế.
{% 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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và sử dụng các ID tài liệu và thư mục thực tế.
{% 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" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và sử dụng các ID tài liệu và thư mục thực tế.
{% endhint %}
{% endtab %}
{% endtabs %}

## Xóa Memento

{% openapi src="/files/uCR2Hrq9CjDxpCLaqzhl" path="/mementos/{id}/" method="delete" %}
[rememberizer\_openapi.yml](https://4187618229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwbxu0T4faQnPtKbPzrD5%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=b77a395b-ed7b-4546-9ec7-182d4939fd1b)
{% endopenapi %}

### Ví dụ Yêu cầu

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

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `123` bằng ID memento thực tế.
{% 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 đã được xóa thành công");
  } else {
    console.error("Xóa memento không thành công");
  }
};

deleteMemento(123);
```

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `123` bằng ID memento thực tế.
{% 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 đã được xóa thành công")
    else:
        print("Xóa memento không thành công")

delete_memento(123)
```

{% hint style="info" %}
Để thử nghiệm cuộc gọi API này, hãy thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `123` bằng ID memento thực tế.
{% endhint %}

{% endtabs %


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rememberizer.ai/vi/tai-nguyen-cho-nha-phat-trien/api-docs/mementos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
