# Lấy tài liệu

{% openapi src="<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>" path="/documents/" 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/documents/?page=1&page_size=20&integration_type=google_drive" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

{% hint style="info" %}
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 getDocuments = async (page = 1, pageSize = 20, integrationType = 'google_drive') => {
  const url = new URL('https://api.rememberizer.ai/api/v1/documents/');
  url.searchParams.append('page', page);
  url.searchParams.append('page_size', pageSize);
  if (integrationType) {
    url.searchParams.append('integration_type', integrationType);
  }
  
  const response = await fetch(url.toString(), {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
  });
  
  const data = await response.json();
  console.log(data);
};

getDocuments();
```

{% hint style="info" %}
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 get_documents(page=1, page_size=20, integration_type=None):
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
    }
    
    params = {
        "page": page,
        "page_size": page_size
    }
    
    if integration_type:
        params["integration_type"] = integration_type
    
    response = requests.get(
        "https://api.rememberizer.ai/api/v1/documents/",
        headers=headers,
        params=params
    )
    
    data = response.json()
    print(data)

get_documents(integration_type="google_drive")
```

{% hint style="info" %}
Thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn.
{% endhint %}
{% endtab %}
{% endtabs %}

## Tham số yêu cầu

| Tham số           | Loại      | Mô tả                                                                                              |
| ----------------- | --------- | -------------------------------------------------------------------------------------------------- |
| page              | số nguyên | Số trang cho phân trang. Mặc định là 1.                                                            |
| page\_size        | số nguyên | Số lượng mục trên mỗi trang. Mặc định là 10.                                                       |
| integration\_type | chuỗi     | Lọc tài liệu theo loại tích hợp. Tùy chọn: google\_drive, slack, dropbox, gmail, common\_knowledge |

## Định dạng Phản hồi

```json
{
  "count": 257,
  "next": "https://api.rememberizer.ai/api/v1/documents/?page=2&page_size=20&integration_type=google_drive",
  "previous": null,
  "results": [
    {
      "document_id": "1aBcD2efGhIjK3lMnOpQrStUvWxYz",
      "name": "Đề xuất Dự án.docx",
      "type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "path": "/Documents/Projects/Proposal.docx",
      "url": "https://drive.google.com/file/d/1aBcD2efGhIjK3lMnOpQrStUvWxYz/view",
      "id": 12345,
      "integration_type": "google_drive",
      "source": "user@example.com",
      "status": "đã lập chỉ mục",
      "indexed_on": "2023-06-15T10:30:00Z",
      "size": 250000
    },
    // ... nhiều tài liệu hơn
  ]
}
```

## Các loại tích hợp có sẵn

| Loại tích hợp     | Mô tả                     |
| ----------------- | ------------------------- |
| google\_drive     | Tài liệu từ Google Drive  |
| slack             | Tin nhắn và tệp từ Slack  |
| dropbox           | Tệp từ Dropbox            |
| gmail             | Email từ Gmail            |
| common\_knowledge | Nguồn kiến thức công khai |

Điểm cuối này lấy danh sách tài liệu từ các nguồn dữ liệu đã kết nối của bạn. Bạn có thể lọc theo loại tích hợp để tập trung vào các nguồn cụ thể.
