REST Resource: properties
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tài nguyên: Thuộc tính
Một cặp khoá-giá trị được đính kèm vào một tệp công khai hoặc riêng tư đối với một ứng dụng.
Các giới hạn sau đây áp dụng cho thuộc tính tệp:
- Tối đa 100 thuộc tính cho mỗi tệp
- Tối đa 30 tài sản riêng tư trên mỗi ứng dụng
- Tối đa 30 tài sản công khai
- Giới hạn kích thước tối đa 124 byte đối với chuỗi (khoá + giá trị) được mã hoá theo UTF-8 cho một thuộc tính
Một số phương thức tài nguyên (chẳng hạn như properties.update
) yêu cầu propertyKey
. Sử dụng phương thức properties.list
để truy xuất khoá cho một thuộc tính.
Biểu diễn dưới dạng JSON |
{
"selfLink": string,
"value": string,
"visibility": string,
"kind": string,
"etag": string,
"key": string
} |
Trường |
selfLink |
string
Chỉ có đầu ra. Đường liên kết quay lại cơ sở lưu trú này.
|
value |
string
Giá trị của thuộc tính này.
|
visibility |
string
Chế độ hiển thị của thuộc tính này. Các giá trị được phép là RIÊNG (mặc định) và CÔNG KHAI. Bạn chỉ có thể truy xuất tài sản riêng tư bằng một yêu cầu đã được xác thực. Yêu cầu đã xác thực sử dụng mã truy cập được lấy bằng mã ứng dụng khách OAuth 2. Bạn không thể sử dụng khoá API để truy xuất các tài sản riêng tư.
|
kind |
string
Chỉ có đầu ra. Giá trị này luôn là drive#property .
|
etag |
string
Chỉ có đầu ra. ETag của tài sản.
|
key |
string
Khoá của thuộc tính này.
|
Phương thức |
|
Xoá một tài sản. |
|
Lấy một thuộc tính theo khoá của thuộc tính đó. |
|
Thêm một thuộc tính vào tệp hoặc cập nhật thuộc tính đó nếu thuộc tính đó đã tồn tại. |
|
Liệt kê các thuộc tính của tệp. |
|
Cập nhật một cơ sở lưu trú. |
|
Cập nhật một cơ sở lưu trú. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],[],null,["# REST Resource: properties\n\n- [Resource: Property](#Property)\n - [JSON representation](#Property.SCHEMA_REPRESENTATION)\n- [Methods](#METHODS_SUMMARY)\n\nResource: Property\n------------------\n\nA key-value pair attached to a file that is either public or private to an application.\n\nThe following limits apply to file properties:\n\n- Maximum of 100 properties total per file\n- Maximum of 30 private properties per app\n- Maximum of 30 public properties\n- Maximum of 124 bytes size limit on (key + value) string in UTF-8 encoding for a single property\n\nSome resource methods (such as `properties.update`) require a `propertyKey`. Use the `properties.list` method to retrieve the key for a property.\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------------------------|\n| ``` { \"selfLink\": string, \"value\": string, \"visibility\": string, \"kind\": string, \"etag\": string, \"key\": string } ``` |\n\n| Fields ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `selfLink` | `string` Output only. The link back to this property. |\n| `value` | `string` The value of this property. |\n| `visibility` | `string` The visibility of this property. Allowed values are PRIVATE (default) and PUBLIC. Private properties can only be retrieved using an authenticated request. An authenticated request uses an access token obtained with a OAuth 2 client ID. You cannot use an API key to retrieve private properties. |\n| `kind` | `string` Output only. This is always `drive#property`. |\n| `etag` | `string` Output only. ETag of the property. |\n| `key` | `string` The key of this property. |\n\n| Methods ------- ||\n|------------------------------------------------------------------------|----------------------------------------------------------------|\n| ### [delete](/workspace/drive/api/reference/rest/v2/properties/delete) | Deletes a property. |\n| ### [get](/workspace/drive/api/reference/rest/v2/properties/get) | Gets a property by its key. |\n| ### [insert](/workspace/drive/api/reference/rest/v2/properties/insert) | Adds a property to a file, or updates it if it already exists. |\n| ### [list](/workspace/drive/api/reference/rest/v2/properties/list) | Lists a file's properties. |\n| ### [patch](/workspace/drive/api/reference/rest/v2/properties/patch) | Updates a property. |\n| ### [update](/workspace/drive/api/reference/rest/v2/properties/update) | Updates a property. |"]]