Sets the specified user’s password to the specified value.
Use setPassword() to change the password of a User or SelfServiceUser to a value that you specify. For example, a client application might prompt a user to specify a different password, and then invoke setPassword() to change the user’s password. Use resetPassword() instead if you want to reset the password with a random value generated by the API.
Your client application must be logged in with sufficient access rights to change the password for the specified user. For more information, see Factors that Affect Data Access.
For information on IDs, see ID Field Type.
This call can use the session ID returned in LoginResult if the password has expired. For more information, see passwordExpired.
public void doSetPassword() { try { String userId = connection.getUserInfo().getUserId(); String newPasswd = "test1234"; SetPasswordResult result = connection.setPassword(userId, newPasswd); System.out.println("User ID " + userId + " password changed to: " + newPasswd); } catch (ConnectionException ce) { ce.printStackTrace(); } }
private void setPassword() { //Invoke setPassword call; returns nothing if successful binding.setPassword("userid", "newpassword"); }
| Name | Type | Description |
|---|---|---|
| userID | ID | ID of the User or SelfServiceUser whose password you want to reset. For information on IDs, see ID Field Type. |
| password | string | New password to use for the specified user. |