Set password for a given user.
Name | Type | Description |
userid | string | either an integer user ID, "current", or "=" followed by a double uri-encoded user name |
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) |
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 |
Input:
Content-type=text/plain
The following code example sets newuser1's password to "newpassword".
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);
Add notes about requirements or config values.
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.
curl -u admin:password -T password.txt -H "Content-Type: text/plain" -i http://mindtouch.address/@api/deki/users/=foo/password
curl -u user:password -T password.txt -H "Content-Type: text/plain" -i http://mindtouch.address/@api/deki/users/=foo/password?currentpassword=bar
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".
Content-Type: text/plain
speck
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/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