UserService

PATCH /api/users/{user}

Changed on

UpdateUser updates a user. Users may update themselves; admins may update anyone. Changing the password ends the user's other sessions.

Request

  • The document declares no server URL.
  • Auth
    none declared

Path parameters

userstring required

The user id.

Query parameters

updateMaskstring field-mask

Required. The fields to update. Supported paths: username, display_name, email, avatar_url, description, password, role, state. role and state require an admin.

allowMissingboolean

Optional. Currently ignored; updating a missing user fails with NOT_FOUND.

Request body

namestring

Identifier. The resource name of the user. {user} is the username. Format: users/{user}

usernamestring required

Required. The unique username, used to sign in.

displayNamestring

Optional. The display name of the user.

emailstring

Optional. The email address of the user. Stored trimmed and lowercased; empty means no address. An address belongs to at most one user on the instance, so writes that would reuse one fail with ALREADY_EXISTS. Returned only to the user and to admins.

avatarUrlstring

Optional. The avatar URL of the user. An avatar set as a data URI (PNG, JPEG, GIF or WebP, at most 2 MiB) is returned as a file server URL.

descriptionstring

Optional. The description of the user.

passwordstring

Input only. The password of the user. Never returned.

role'ROLE_UNSPECIFIED' | 'ADMIN' | 'USER' enum required

Required. The role of the user. Only admins can change it.

state'STATE_UNSPECIFIED' | 'NORMAL' | 'ARCHIVED' enum required

Required. The state of the user. Only admins can change it.

createTimestring date-time

Output only. The creation timestamp.

updateTimestring date-time

Output only. The last update timestamp.

Response

OK

namestring

Identifier. The resource name of the user. {user} is the username. Format: users/{user}

usernamestring required

Required. The unique username, used to sign in.

displayNamestring

Optional. The display name of the user.

emailstring

Optional. The email address of the user. Stored trimmed and lowercased; empty means no address. An address belongs to at most one user on the instance, so writes that would reuse one fail with ALREADY_EXISTS. Returned only to the user and to admins.

avatarUrlstring

Optional. The avatar URL of the user. An avatar set as a data URI (PNG, JPEG, GIF or WebP, at most 2 MiB) is returned as a file server URL.

descriptionstring

Optional. The description of the user.

passwordstring

Input only. The password of the user. Never returned.

role'ROLE_UNSPECIFIED' | 'ADMIN' | 'USER' enum required

Required. The role of the user. Only admins can change it.

state'STATE_UNSPECIFIED' | 'NORMAL' | 'ARCHIVED' enum required

Required. The state of the user. Only admins can change it.

createTimestring date-time

Output only. The creation timestamp.

updateTimestring date-time

Output only. The last update timestamp.

Changes