Method: labels.get
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.
Lấy nhãn theo tên tài nguyên. Để biết thêm thông tin, hãy xem bài viết Tìm nhãn.
Tên tài nguyên có thể là bất kỳ tên nào sau đây:
labels/{id}
– Xem labels/{id}@latest
labels/{id}@latest
– Lấy bản sửa đổi mới nhất của nhãn.
labels/{id}@published
– Nhận bản sửa đổi đã xuất bản hiện tại của nhãn.
labels/{id}@{revisionId}
– Lấy nhãn tại mã nhận dạng bản sửa đổi được chỉ định.
Yêu cầu HTTP
GET https://drivelabels.googleapis.com/v2/{name=labels/*}
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Thông số |
name |
string
Bắt buộc. Tên tài nguyên nhãn. Có thể là bất kỳ giá trị nào trong số:
labels/{id} (tương đương với labels/{id}@latest)
labels/{id}@latest
labels/{id}@published
labels/{id}@{revisionId}
|
Tham số truy vấn
Thông số |
useAdminAccess |
boolean
Đặt thành true để sử dụng thông tin đăng nhập quản trị của người dùng. Máy chủ sẽ xác minh rằng người dùng là quản trị viên của nhãn trước khi cho phép truy cập.
|
languageCode |
string
Mã ngôn ngữ BCP-47 dùng để đánh giá nhãn trường được bản địa hoá. Khi không được chỉ định, các giá trị bằng ngôn ngữ được định cấu hình mặc định sẽ được sử dụng.
|
view |
enum (LabelView )
Khi được chỉ định, chỉ một số trường thuộc khung hiển thị được chỉ định mới được trả về.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một phiên bản của Label
.
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/drive.labels
https://www.googleapis.com/auth/drive.labels.readonly
https://www.googleapis.com/auth/drive.admin.labels
https://www.googleapis.com/auth/drive.admin.labels.readonly
Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
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-08-05 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-05 UTC."],[],[],null,["# Method: labels.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nGet a label by its resource name. For more information, see [Search for labels](https://developers.google.com/workspace/drive/labels/guides/search-label).\n\nResource name may be any of:\n\n- `labels/{id}` - See `labels/{id}@latest`\n- `labels/{id}@latest` - Gets the latest revision of the label.\n- `labels/{id}@published` - Gets the current published revision of the label.\n- `labels/{id}@{revisionId}` - Gets the label at the specified revision ID.\n\n### HTTP request\n\n`GET https://drivelabels.googleapis.com/v2/{name=labels/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. Label resource name. May be any of: - `labels/{id}` (equivalent to labels/{id}@latest) - `labels/{id}@latest` - `labels/{id}@published` - `labels/{id}@{revisionId}` |\n\n### Query parameters\n\n| Parameters ||\n|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `useAdminAccess` | `boolean` Set to `true` in order to use the user's admin credentials. The server verifies that the user is an admin for the label before allowing access. |\n| `languageCode` | `string` The BCP-47 language code to use for evaluating localized field labels. When not specified, values in the default configured language are used. |\n| `view` | `enum (`[LabelView](/workspace/drive/labels/reference/rest/v2/LabelView)`)` When specified, only certain fields belonging to the indicated view are returned. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [Label](/workspace/drive/labels/reference/rest/v2/labels#Label).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive.labels`\n- `\n https://www.googleapis.com/auth/drive.labels.readonly`\n- `\n https://www.googleapis.com/auth/drive.admin.labels`\n- `\n https://www.googleapis.com/auth/drive.admin.labels.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]