Lấy về tệp (đối với API key gán quyền Read)
a. Lấy về tệp (không kèm dữ liệu)
API:
Method | URL |
---|---|
GET | https://app.docbase.ai/api/v1/submissions/<submission_id> |
Response:
{
"id": "5138c6f9-0ed5-4a06-90ed-8ef0a8bf2430",
"created_at": "2024-05-06T08:37:33.102602Z",
"updated_at": "2024-08-07T04:03:00.708027Z",
"last_ocr_time": "2024-05-06T08:37:33.102472Z",
"deleted_at": null,
"name": "Hoa_don",
"status": "for_review",
"ocr_error_code": null,
"note": null,
"reviewing": false,
"sorted_documents": null,
"last_export_time": null,
"turnaround_time": null,
"validate_time": null,
"edit_rate": null,
"validated_at": null,
"auto_verified": false,
"upload_source": "web",
"message_id": null,
"folder": "fd38c314-e9ce-4794-be0d-db091f96a962",
"validated_by": null,
"owner": "537004c7-c79f-450c-9a4a-751cc5ba9644",
"validator": null,
"rejected_by": null,
"reviewing_by": null,
"documents_count": 1,
"files_count": 1,
"unclassified_pages_count": 0,
"unclassified_files": [],
"documents": [...],
"files": [...]
"pages_count": 1
}
Ví dụ cho trường documents
"documents": [
{
"id": "27d72697-1076-452b-8d85-8f437979e68d",
"page_set": [
"a5c39172-40d1-412b-a531-d4449ae80477",
"1d08d58f-5462-4afe-b922-71fe0986c153"
],
"created_at": "2024-05-06T08:37:40.914655Z",
"updated_at": "2024-05-06T08:37:40.914680Z",
"deleted_at": null,
"name": "Hóa đơn",
"status": "for_review",
"last_data_changed": null,
"note": null,
"ocr_error_code": "0",
"last_validated_at": null,
"last_verified_at": null,
"sorted_pages": null,
"document_type": "invoice",
"archived": false,
"submission": "5138c6f9-0ed5-4a06-90ed-8ef0a8bf2430",
"users": []
}
]
b. Lấy về tệp (có kèm dữ liệu)
API:
Method | URL |
---|---|
GET | https://app.docbase.ai/api/v1/submissions/<submission_id>/data |
Response:
Cấu trúc trả về tương tự phần a., tuy nhiên ở trong phần documents, sẽ có thêm 1 trường là data_set: là 1 danh sách của các dữ liệu đọc được trong văn bản.
{
...,
"documents": [
{
"id": "27d72697-1076-452b-8d85-8f437979e68d",
...,
"users": [],
"data_set": []
}
]
}
Data set là các dữ liệu trong một văn bản tài liệu, sẽ gồm các dữ liệu Data được phân chia theo dạng cây với các kiểu dữ liệu được đề cập ở phần Kiểu dữ liệu.
c. Lấy về nhiều tệp (không kèm dữ liệu)
API:
Method | URL |
---|---|
GET | https://app.docbase.ai/api/v1/folders/<folder_id>/submissions |
Params:
Key | Mô tả/Giá trị |
---|---|
limit | Giới hạn số tệp lấy về |
offset | Số trang, bắt đầu từ 0 |
search | Tìm kiếm theo tên |
status | for_review /process_error /for_verify /verified /processing /exported |
start | Chặn trên của ngày tải lên |
end | Chặn dưới của ngày tải lên |
Response:
d. Lấy về thông tin chung của bộ hồ sơ
API:
Method | URL |
---|---|
GET | https://app.docbase.ai/api/v1/submissions/<submission_id>/general-data |
Response:
Response cấu trúc trả về gồm:
- count: Số tệp
- next: URL cho trang tiếp theo
- previous: URL cho trang trước
- results: Danh sánh thông tin các tệp, mỗi phần tử trong danh sách sẽ có giá trị tương tự phần response của phần a.
e. Lấy về ảnh của tệp
API:
Method | URL |
---|---|
GET | https://app.docbase.ai/api/v1/files/<file_id>/document |
Response:
Dạng ảnh của tệp
f. Lấy về ảnh của từng trang trong tệp
API:
Method | URL |
---|---|
GET | https://app.docbase.ai/api/v1/pages/<page_id>/photo |
Response:
Dạng ảnh của từng trang trong tệp
Chú ý tham số:
Key | Mô tả |
---|---|
folder_id | id của thư mục lấy trên hệ thống Để lấy id của thư mục: Tài liệu → {{Thư mục bất kỳ}} → Cài đặt ID của thư mục sẽ xuất hiện trong mục Thông tin thư mục ![]() |
file_id | id của tệp lấy trên hệ thống |
page_id | id của trang lấy trên hệ thống |