Tải lên tệp giấy tờ
Được sử dụng để tải lên tệp giấy tờ và lấy fileId. Đây là bước 1 trong quy trình tải lên giấy tờ doanh nghiệp (two-phase process).
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
| miniAppId | Long | true | ID của Mini App |
| file | File | true | Tệp giấy tờ cần tải lên |
| fileName | String | true | Tên tệp (SDK Node.js yêu cầu, server sử dụng để hiển thị/fileName trả về) |
| documentType | String | false | Tên loại giấy tờ (legacy, tương ứng với documentTypeId nếu có) |
| subCategoryId | Integer | false | ID danh mục con liên quan tới giấy tờ |
Định dạng và kích thước tệp
- Kích thước tối đa: 5 MB
- Định dạng được hỗ trợ: pdf, png, jpg, jpeg
Return Values
| Property | Type | Description |
|---|---|---|
| error | int | Mã lỗi của kết quả trả về, bằng 0 nếu request thành công |
| message | String | Lời nhắn chi tiết tương ứng với mã lỗi |
| data | Object | Thông tin tệp đã tải lên |
Data Object
| Property | Type | Description |
|---|---|---|
| fileId | String | ID của tệp đã tải lên (dùng cho bước 2) |
| fileName | String | Tên của tệp đã tải lên |
Sample Code
import java.io.File;
import com.vng.zalo.miniapp.openapi.sdk.models.documents.request.UploadDocumentFileRequest;
import com.vng.zalo.miniapp.openapi.sdk.models.documents.response.UploadDocumentFileResponse;
File testFile = new File("/path/to/your/document.pdf");
UploadDocumentFileRequest request = new UploadDocumentFileRequest();
request.setMiniAppId(YOUR_MINI_APP_ID);
request.setFile(testFile);
UploadDocumentFileResponse response = client.uploadDocumentFile(request);
// Lấy fileId để sử dụng trong bước tiếp theo
String fileId = response.getData().getFileId();
String fileName = response.getData().getFileName();