Skip Navigation LinksHome Page > Forums > SpiraTeam Forums > SpiraTeam Issues & Qu... > How to reset user passwor...
I have Salesforce admin credentials and a password reset query. I want to reset the user password using Rest API. How to reset a user password using RestAPI in the Salesforce application? What is the password reset endpoint?
User Usr1 = [Select Id from User where username= 'user1']; System.setPassword(usr1.Id,'Test123');
Users are treated as an sObject, so its the data api, so you access it at
https://<instance>.salesforce.com/services/data/v25.0/sobjects/User/<UserId>
and the password is at
https://<instance>.salesforce.com/services/data/v25.0/sobjects/User/<UserId>/password
To change a password using Curl Create a file with contents like these (it must be valid json), and save it somewhere.
{ "NewPassword" : "myNewPassword1234" }
then post to the service using a curl command like (fill in yourInstance, UserId, yourOAuthToken, and yourPasswdFile):
curl https://<yourInstance>.salesforce.com/services/data/v25.0/sobjects/User/<UserId>/password -H "Authorization: Bearer <yourOAuthToken>" —H "Content-Type: application/json" —d @<yourPasswdFile>.json —X POST
Theres more information and sample curl commands at
https://developer.salesforce.com/docs/atlas.en-
us.api_rest.meta/api_rest/dome_sobject_user_password.htm#!
I hope you got a lot of information in this answer. but still wanted to gain more information regarding this question then check out this link salesforce administrator training. This Training is for Beginners, Intermediate, and advanced Salesforce users to enhance their knowledge and understanding of the Salesforce CRM platform.
And if you have any questions, please email or call us at +1 (202) 558-6885