Use resetPassword() to request that the API change the password of a User or SelfServiceUser, and return a system-generated password string of random letters and numbers. Use setPassword() instead if you want to set the password to a specific value.
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.
This sample resets the password for the user specified by the userId parameter. It calls resetPassword() with this ID and gets the temporary password from the call result. It writes this temporary password to the console and returns it.
1public String doResetPassword(String userId) {2 String result = "";3 try {4 ResetPasswordResult rpr = connection.resetPassword(userId);5 result = rpr.getPassword();6 System.out.println("The temporary password for user ID " + userId7 + " is " + result);8 } catch (ConnectionException ce) {9 ce.printStackTrace();10 }11 return result;12}
Sample Code—C#
This sample resets the password for the user specified by the userId parameter. It calls resetPassword() with this ID and gets the temporary password from the call result. It writes this temporary password to the console and returns it.
1public String doResetPassword(String userId)2{3 String result = "";4 try5 {6 ResetPasswordResult rpr = binding.resetPassword(userId);7 result = rpr.password;8 Console.WriteLine("The temporary password for user ID " + userId + " is " +9 result);10 }11 catch (SoapException e)12 {13 Console.WriteLine("An unexpected error has occurred: " +14 e.Message + "\n" + e.StackTrace);15 }16 return result;17}
New password generated by the API. When the user logs in with this password, they’re asked to provide a new password. This password is temporary, meaning that it cannot be reused after the user has set their new password.