Method: users.messages.modify
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Modyfikuje etykiety określonej wiadomości.
Żądanie HTTP
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}/modify
Adres URL używa składni transkodowania gRPC.
Parametry ścieżki
Parametry |
userId |
string
Adres e-mail użytkownika. Wartość specjalna me może służyć do wskazywania uwierzytelnionego użytkownika.
|
id |
string
Identyfikator wiadomości, którą chcesz zmodyfikować.
|
Treść żądania
Treść żądania zawiera dane o następującej strukturze:
Zapis JSON |
{
"addLabelIds": [
string
],
"removeLabelIds": [
string
]
} |
Pola |
addLabelIds[] |
string
Lista identyfikatorów etykiet do dodania do tej wiadomości. Do każdej aktualizacji możesz dodać maksymalnie 100 etykiet.
|
removeLabelIds[] |
string
Lista identyfikatorów etykiet do usunięcia z tej wiadomości. W ramach każdej aktualizacji możesz usunąć maksymalnie 100 etykiet.
|
Treść odpowiedzi
W przypadku powodzenia treść odpowiedzi obejmuje wystąpienie elementu Message
.
Zakresy autoryzacji
Wymaga jednego z tych zakresów OAuth:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
Więcej informacji znajdziesz w przewodniku dotyczącym autoryzacji.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[],[],null,["# Method: users.messages.modify\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nModifies the labels on the specified message.\n\n### HTTP request\n\n`POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}/modify`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------|\n| `userId` | `string` The user's email address. The special value `me` can be used to indicate the authenticated user. |\n| `id` | `string` The ID of the message to modify. |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------------------------------------------|\n| ``` { \"addLabelIds\": [ string ], \"removeLabelIds\": [ string ] } ``` |\n\n| Fields ||\n|--------------------|--------------------------------------------------------------------------------------------------------------|\n| `addLabelIds[]` | `string` A list of IDs of labels to add to this message. You can add up to 100 labels with each update. |\n| `removeLabelIds[]` | `string` A list IDs of labels to remove from this message. You can remove up to 100 labels with each update. |\n\n### Response body\n\nIf successful, the response body contains an instance of [Message](/workspace/gmail/api/reference/rest/v1/users.messages#Message).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://mail.google.com/`\n- `\n https://www.googleapis.com/auth/gmail.modify`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]