Password Set while creating user through API Rest Payload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 09:59 PM
Hi,
I am using rest API to create user on Service Now
and my payload
{"user_name":"Watson",
"first_name":"John",
"last_name":"Watson",
"email":"watson@bcone.com",
"city":"Pune",
"department":"IT",
"user_password":"pass,123"
}
when i run this it create the user on service now but it set the user_password as "pass,123" not as encrypted form so when i try to login with that password it says wrong password.
But when i fetch the different existing user from service now it shows me the password in encrypted form ie.
"user_password": "$s$AJFl3zx3LV/bClnko1qSKXDoavxl4zAHGqq5FzmJdQw=$2zgOx5fqrBM2t7uLJwKhO9Vi3hZkKNCF+M6o26Thh3I="
so i want to know how i encrypt my password and send it through payload or is there any other way to Set the user password.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 10:26 PM
If you wanted to set the incoming string as the actual password (pre-encrypted), you can use the REST parameter, sysparm_input_display_value=true. This will set "pass,123" as the password and encrypt the value in the database. The same way as GlideRecord.setDisplayValue("user_password","pass,123").
Just be aware that all inbound field values will be considered display values as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2016 07:40 PM
You're the best. This worked like a charm.