Method: users.messages.batchModify
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Zmienia etykiety wybranych wiadomości.
Żądanie HTTP
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/batchModify
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.
|
Treść żądania
Treść żądania zawiera dane o następującej strukturze:
Zapis JSON |
{
"ids": [
string
],
"addLabelIds": [
string
],
"removeLabelIds": [
string
]
} |
Pola |
ids[] |
string
Identyfikatory wiadomości, które chcesz zmodyfikować. Obowiązuje limit 1000 identyfikatorów na żądanie.
|
addLabelIds[] |
string
Lista identyfikatorów etykiet do dodania do wiadomości.
|
removeLabelIds[] |
string
Lista identyfikatorów etykiet do usunięcia z wiadomości.
|
Treść odpowiedzi
W przypadku powodzenia treść odpowiedzi jest pusta.
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.batchModify\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 messages.\n\n### HTTP request\n\n`POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/batchModify`\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\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------------------------------|\n| ``` { \"ids\": [ string ], \"addLabelIds\": [ string ], \"removeLabelIds\": [ string ] } ``` |\n\n| Fields ||\n|--------------------|---------------------------------------------------------------------------------------|\n| `ids[]` | `string` The IDs of the messages to modify. There is a limit of 1000 ids per request. |\n| `addLabelIds[]` | `string` A list of label IDs to add to messages. |\n| `removeLabelIds[]` | `string` A list of label IDs to remove from messages. |\n\n### Response body\n\nIf successful, the response body is empty.\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)."]]