Method: Auth0::Api::V2::Users#patch_user

Defined in:
lib/auth0/api/v2/users.rb

#patch_user(user_id, body) ⇒ json Also known as: update_user

Updates a user with the object’s properties received in the optional parameters. These are the attributes that can be updated at the root level: blocked, email_verified, email, verify_email, password, phone_number, phone_verified, verify_password, user_metadata, app_metadata, username Some considerations: The properties of the new object will replace the old ones. The metadata fields are an exception to this rule (user_metadata and app_metadata). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. If you are updating email_verified, phone_verified, username or password you need to specify the connection property too. If your are updating email or phone_number you need to specify the connection and the client_id properties.

Parameters:

  • user_id (string)

    The user_id of the user to update.

  • body (hash)

    The optional parameters to update.

Returns:

  • (json)

    Returns the updated user.

Raises:

See Also:



106
107
108
109
110
111
# File 'lib/auth0/api/v2/users.rb', line 106

def patch_user(user_id, body)
  raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?
  raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?
  path = "#{users_path}/#{user_id}"
  patch(path, body)
end