Method: users.messages.modify
Mengubah label pada pesan yang ditentukan.
Permintaan HTTP
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}/modify
URL menggunakan sintaksis gRPC Transcoding.
Parameter jalur
Parameter |
userId |
string
Alamat email pengguna. Nilai khusus me dapat digunakan untuk menunjukkan pengguna terautentikasi.
|
id |
string
ID pesan yang akan diubah.
|
Isi permintaan
Isi permintaan memuat data dengan struktur berikut:
Representasi JSON |
{
"addLabelIds": [
string
],
"removeLabelIds": [
string
]
} |
Kolom |
addLabelIds[] |
string
Daftar ID label yang akan ditambahkan ke pesan ini. Anda dapat menambahkan hingga 100 label dalam setiap pembaruan.
|
removeLabelIds[] |
string
ID daftar label yang akan dihapus dari pesan ini. Anda dapat menghapus hingga 100 label dalam setiap pembaruan.
|
Isi respons
Jika berhasil, isi respons memuat instance Message
.
Cakupan otorisasi
Memerlukan salah satu cakupan OAuth berikut:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
Untuk informasi selengkapnya, lihat Panduan otorisasi.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-09-05 UTC.
[null,null,["Terakhir diperbarui pada 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"]]