Method: users.threads.modify
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Modifica le etichette applicate al thread. Questo vale per tutti i messaggi del thread.
Richiesta HTTP
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/threads/{id}/modify
L'URL utilizza la sintassi di transcodifica gRPC.
Parametri del percorso
Parametri |
userId |
string
L'indirizzo email dell'utente. Il valore speciale me può essere utilizzato per indicare l'utente autenticato.
|
id |
string
L'ID del thread da modificare.
|
Corpo della richiesta
Il corpo della richiesta contiene dati con la seguente struttura:
Rappresentazione JSON |
{
"addLabelIds": [
string
],
"removeLabelIds": [
string
]
} |
Campi |
addLabelIds[] |
string
Un elenco di ID delle etichette da aggiungere a questo thread. Puoi aggiungere fino a 100 etichette con ogni aggiornamento.
|
removeLabelIds[] |
string
Un elenco di ID delle etichette da rimuovere da questo thread. Puoi rimuovere fino a 100 etichette con ogni aggiornamento.
|
Corpo della risposta
In caso di esito positivo, il corpo della risposta contiene un'istanza di Thread
.
Ambiti di autorizzazione
Richiede uno dei seguenti ambiti OAuth:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
Per ulteriori informazioni, consulta la Guida all'autorizzazione.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-25 UTC.
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[],[],null,["# Method: users.threads.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 applied to the thread. This applies to all messages in the thread.\n\n### HTTP request\n\n`POST https://gmail.googleapis.com/gmail/v1/users/{userId}/threads/{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 thread 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 thread. You can add up to 100 labels with each update. |\n| `removeLabelIds[]` | `string` A list of IDs of labels to remove from this thread. You can remove up to 100 labels with each update. |\n\n### Response body\n\nIf successful, the response body contains an instance of [Thread](/workspace/gmail/api/reference/rest/v1/users.threads#Thread).\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)."]]