Method: users.messages.modify
Sửa đổi các nhãn trên thư được chỉ định.
Yêu cầu HTTP
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}/modify
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Tham số |
userId |
string
Địa chỉ email của người dùng. Giá trị đặc biệt me có thể dùng để cho biết người dùng đã được xác thực.
|
id |
string
Mã nhận dạng của thông báo cần sửa đổi.
|
Nội dung yêu cầu
Nội dung yêu cầu chứa dữ liệu có cấu trúc sau:
Biểu diễn dưới dạng JSON |
{
"addLabelIds": [
string
],
"removeLabelIds": [
string
]
} |
Trường |
addLabelIds[] |
string
Danh sách mã nhận dạng của các nhãn cần thêm vào thư này. Bạn có thể thêm tối đa 100 nhãn cho mỗi lần cập nhật.
|
removeLabelIds[] |
string
Mã danh sách của các nhãn cần xoá khỏi thư này. Bạn có thể xoá tối đa 100 nhãn trong mỗi lần cập nhật.
|
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 Message
.
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
Để 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: 2024-09-05 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-09-05 UTC."],[[["This endpoint modifies labels on a specific message by adding or removing label IDs."],["The request requires the user's email address (`userId`), the message ID (`id`), and a JSON body specifying label IDs to add or remove."],["A successful response returns the updated message details."],["Authorization is required using specific OAuth scopes, such as `https://mail.google.com/` or `https://www.googleapis.com/auth/gmail.modify`."],["Users can leverage this functionality to programmatically manage email labels within their Gmail accounts."]]],["This API modifies labels on a specified Gmail message. It uses a `POST` request to the provided URL, with `userId` and `id` as path parameters, representing the user's email and the message's ID. The request body, in JSON format, includes `addLabelIds` and `removeLabelIds` arrays of label IDs, allowing up to 100 labels per array to be added or removed. Successful requests return a Message instance and require OAuth scopes `https://mail.google.com/` or `https://www.googleapis.com/auth/gmail.modify`.\n"]]