You need to sign in to do that
Don't have an account?
RestTest
Reset Password and "disable" account using REST api?
Hi,
I have also 2 other questions.
Using rest apis, how do I change and/or reset a user password? (Do you have a code sample showing which property to set, if password is sent plain text, encoded, hashed etc...)
Also, how do I "disable" an account using the REST apis?
Thank you very much for your help.
http://boards.developerforce.com/t5/NET-Development/Why-is-my-date-number-boolean-being-ignored-for-create-and/td-p/4708
All Answers
Hi RestTest,
Currently there is no way to change/reset user password from the REST API. It is possible, however, to disable a user account via the REST API - simply update the User object, setting the IsActive field to false. Here is a PHP sample that does this:
Cheers,
Pat
Thanks for this information.
If REST is not able to change/reset a password, do you know an alternate way to do it programmatically?
You can use setPassword() and resetPassword() in the SOAP API - see http://www.salesforce.com/us/developer/docs/api/Content/utility_calls.htm
I have given up the REST api since they are incomplete (no Set or Reset Password) and I don't want to have to integrate 2 different API sets.
Therefore I switched to web services.
To disable a user, I'm calling the following function.
It returns without error, but it does not disable the account. (If I change another field, for example firstname, the field is correctly updated).
Do you have a sample showing how to disable a user?
internal void SuspendUser(string loginID)
{
User newUser = new User();
newUser.Id = loginID;
newUser.IsActive = false;
SaveResult[] results = _Binding.update(new sObject[] { newUser });
if (!results[0].success)
{
StringBuilder sb = new StringBuilder();
foreach (Error error in results[0].errors)
{
sb.Append(string.Format("Code: {0}, Error: {1}", error.statusCode.ToString(), error.message));
}
throw new Exception(sb.ToString());
}
}
Thanks.
http://boards.developerforce.com/t5/NET-Development/Why-is-my-date-number-boolean-being-ignored-for-create-and/td-p/4708
Great thanks, It works.
I could have spend weeks to find this !