Users.labels: patch

Updates the specified label. This method supports patch semantics. Try it now or see an example.


HTTP request



Parameter name Value Description
Path parameters
id string The ID of the label to update.
userId string The user's email address. The special value me can be used to indicate the authenticated user.


This request requires authorization with at least one of the following scopes:


For more information, see the authentication and authorization page.

Request body

In the request body, supply the relevant portions of a Users.labels resource, according to the rules of patch semantics.


If successful, this method returns a Users.labels resource in the response body.


Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).


Uses the Java client library.



// ...

public class MyClass {

  // ...

   * Updates the specified label.
   * @param service Authorized Gmail API instance.
   * @param userId User's email address. The special value "me"
   * can be used to indicate the authenticated user.
   * @param labelId ID of Label to patch.
   * @param labelPatch Label with properties to patch.
   * @throws IOException
  public static void patchLabel(Gmail service, String userId, String labelId, Label labelPatch)
      throws IOException {
    Label patchedLabel = service.users().labels().patch(userId, labelId, labelPatch).execute();

    System.out.println("Label with ID " + labelId + " patched sucessfully.");

  // ...

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Enviar comentarios sobre…

¿Necesitas ayuda? Visita nuestra página de asistencia.