Lối tắt của bên thứ ba trong Google Drive là các tệp chỉ có siêu dữ liệu và liên kết đến các tệp khác trên hệ thống lưu trữ bên ngoài do bên thứ ba sở hữu. Các phím tắt này đóng vai trò làm liên kết tham chiếu đến "nội dung" các tệp được ứng dụng bên ngoài lưu trữ Drive, thường nằm trong một kho dữ liệu hoặc hệ thống lưu trữ trên đám mây khác.
Để tạo lối tắt cho bên thứ ba, hãy sử dụng phương thức files.create
của API Google Drive và thiết lập
loại MIME thành application/vnd.google-apps.drive-sdk
. Không tải bất kỳ tệp nào lên
khi tạo tệp. Để biết thêm thông tin, hãy xem bài viết Google Workspace
và các loại MIME được Google Drive hỗ trợ.
Bạn không thể tải lên hoặc tải lối tắt của bên thứ ba xuống.
Các mã mẫu sau đây minh hoạ cách tạo lối tắt của bên thứ ba bằng một thư viện ứng dụng:
Java
Python
PHP
.NET
Node.js
Cách hoạt động của lối tắt của bên thứ ba
Khi bạn tạo lối tắt của bên thứ ba bằng phương thức files.create
, lối tắt này sẽ sử dụng
yêu cầu chèn siêu dữ liệu POST
và tạo lối tắt đến
nội dung:
POST https://www.googleapis.com/drive/v3/files
Authorization: AUTHORIZATION_HEADER
{
"title": "FILE_TITLE",
"mimeType": "application/vnd.google-apps.drive-sdk"
}
Khi nhấp vào lối tắt của bên thứ ba, người dùng sẽ được chuyển hướng đến lối tắt bên ngoài
trang web chứa tệp. Mã tệp trên Drive có trong
tham số state
. Để biết thêm
thông tin, hãy xem bài viết Xử lý URL mở cho ứng dụng cụ thể
tài liệu.
Sau đó, ứng dụng hoặc trang web bên thứ ba sẽ chịu trách nhiệm so khớp mã tệp trong
tham số state
vào nội dung nằm trong hệ thống của họ.
Thêm hình thu nhỏ tuỳ chỉnh và văn bản có thể lập chỉ mục
Để tăng khả năng phát hiện tệp được liên kết với lối tắt của bên thứ ba, bạn có thể tải lên cả hình thu nhỏ và văn bản có thể lập chỉ mục khi chèn hoặc sửa đổi siêu dữ liệu tệp. Để biết thêm thông tin, hãy xem phần Quản lý siêu dữ liệu tệp.
Chủ đề có liên quan
- Tạo lối tắt đến tệp trên Drive
- Định cấu hình chế độ tích hợp giao diện người dùng Drive
- Các loại MIME được Google Workspace và Google Drive hỗ trợ