Skip to main content
NICE CXone Expert

We will be closed on Thursday November 28th & Friday November 29th due to the Thanksgiving Holiday

Expert Success Center

users/{userid}/password (PUT)

Overview

Set password for a given user.

  • REST Method: PUT
  • Method Access: public

Uri Parameters

Name Type Description
userid string either an integer user ID, "current", or "=" followed by a double uri-encoded user name

Query Parameters

Name Type Description
currentpassword string? Current password needed when changing your own password (without admin rights)
authenticate bool? Force authentication for request (default: false)
altpassword bool? If true, the given password sets a secondary password that can be used for login. The main password is not overwritten. (default: false)

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body
Forbidden 403 Administrator access or account owner is required
Not Found 404 Requested user could not be found

Message Format

Input:
Content-type=text/plain

C# Sample: Set a New Password

The following code example sets newuser1's password to "newpassword".

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
DreamMessage msg = DreamMessage.Ok(MimeType.TEXT, "newpassword");
p.At("users", "=newuser1", "password").Put(msg);

Implementation notes 

Add notes about requirements or config values.

Curl Sample: Set a New Password

The following two commands demonstrate how to set a new password for user "foo" with password "bar". The first command assumes admin permissions. The second assumes regular user permissions, thus the "currentpassword" parameter must be appended to the end of the path.

Sample Code (Admin)

curl -u admin:password -T password.txt -H "Content-Type: text/plain" -i http://mindtouch.address/@api/deki/users/=foo/password

Sample Code (User)

curl -u user:password -T password.txt -H "Content-Type: text/plain" -i http://mindtouch.address/@api/deki/users/=foo/password?currentpassword=bar

Implementation notes 

curl flags

-u
Basic HTTP authentication. Sends a username and password to server so it can verify whether a user is of privilege to perform specific operation.
-H
Adds a header or modifies an existing one. In this case, since passwords are generally plain text, the content type is set to "text/plain".
-T file
Specifies a PUT command and the file that contains the new password.
-i
Includes the HTTP response header in the output. Useful for debugging.

Example

Spock, a regular user, decides to change his rather weak password, "spock", to something slightly less weak. His new password is written in "spockpw.txt".

spockpw.txt

Content-Type: text/plain

speck

Command Line

curl -u spock:spock -T spockpw.txt -H "Content-Type: text/plain" -i http://192.168.168.110/@api/deki/users/=Spock/password?currentpassword=spock

HTTP Response Headers

HTTP/1.1 200 OK
Date: Wed, 13 Jan 2010 01:21:55 GMT
Server: Dream-HTTPAPI/1.7.2.17433
P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
X-Deki-Site: id="default"
Content-Type: text/plain; charset=utf-8
Content-Length: 53
Set-Cookie: authtoken="5_633989425145407260_d70bdc2c5f3c8a572807c5efb4ba7e26"; Domain=192.168.168.110; expires=Wed, 20-Jan-2010 01:21:54 GMT; Version=1; Path=/
Via: 1.1 dekiwiki
Vary: Accept-Encoding

5_633989425145407260_d70bdc2c5f3c8a572807c5efb4ba7e26

 

  • Was this article helpful?