This repository was archived by the owner on Mar 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #632 from RocketChat/rest-api-users-update-own
[NEW] Added docs to users.updateOwnBasicInfo endpoint
- Loading branch information
Showing
5 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
developer-guides/rest-api/users/updateownbasicinfo/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# User Update own basic information | ||
|
||
| URL | Requires Auth | HTTP Method | | ||
| :--- | :--- | :--- | | ||
| `/api/v1/users.updateOwnBasicInfo` | `yes` | `POST` | | ||
|
||
Note that to update the password or email for the user you must send `currentPassword` property encrypted in SHA256 together in payload. | ||
|
||
## Payload | ||
|
||
| Argument | Example | Required | Description | | ||
| :--- | :--- | :--- | :--- | | ||
| `data.email` | `example@example.com` | Optional | The email address for the user. | | ||
| `data.name` | `Example User` | Optional | The display name of the user. | | ||
| `data.username` | `example` | Optional | The username for the user. | | ||
| `data.currentPassword` | `5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5@w0rd` | Optional | The password for the user encrypted in SHA256. | | ||
| `data.newPassword` | `passw0rd` | Optional | The new password for the user | | ||
|
||
## Example Call | ||
|
||
```bash | ||
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ | ||
-H "X-User-Id: aobEdbYhXfu5hkeqG" \ | ||
-H "Content-type:application/json" \ | ||
http://localhost:3000/api/v1/users.updateOwnBasicInfo \ | ||
-d '"data" :{"email": "rocket.cat@rocket.chat", "newPassword": "passw0rd", | ||
"currentPassword": "5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5", | ||
"username": "rocket.cat", name": "Example user" }' | ||
``` | ||
|
||
## Example Result | ||
|
||
```json | ||
{ | ||
"user": { | ||
"_id": "47cRd58HnWwpqxhaZ", | ||
"createdAt": "2018-03-09T13:17:11.951Z", | ||
"services": { | ||
"password": { | ||
"bcrypt": "$2a$10$zb/dp.AHZAhwPzgmOHcQA.5eOfu6pAYU5gchg3O74z7XzWAppJflq" | ||
}, | ||
"email": { | ||
"verificationTokens": [ | ||
{ | ||
"token": "rzDjTJBoN8qdc5LCVM3xqaRHEx0lR9mxkFutB6fv-YP", | ||
"address": "rocket.cat@rocket.chat", | ||
"when": "2018-03-09T13:17:11.968Z" | ||
}, | ||
{ | ||
"token": "bFdoXbtvVl4NYXNMQn-sb6t9TWwuBYkkntakvkNqyzr", | ||
"address": "rocket.cat@rocket.chat", | ||
"when": "2018-03-09T13:18:33.414Z" | ||
}, | ||
{ | ||
"token": "reYkTD_OfKHYgU1p6ON-UyJjvXGODl6EoZ-GLQlg81s", | ||
"address": "rocket.cat@rocket.chat", | ||
"when": "2018-03-09T14:41:21.633Z" | ||
} | ||
] | ||
}, | ||
"resume": { | ||
"loginTokens": [ | ||
{ | ||
"when": "2018-03-09T13:17:12.110Z", | ||
"hashedToken": "T6sIP43ctqMedzVsxiF/dln27ua7l56/Rys+aq7J2JA=" | ||
}, | ||
{ | ||
"hashedToken": "0z7NG4SFO00ZvR71nNqAhK0yv/9OeGJ74WZWAUxzAwA=" | ||
} | ||
] | ||
} | ||
}, | ||
"emails": [ | ||
{ | ||
"address": "rocket.cat@rocket.chat", | ||
"verified": false | ||
} | ||
], | ||
"type": "user", | ||
"status": "online", | ||
"active": true, | ||
"name": "Example User", | ||
"_updatedAt": "2018-03-09T20:21:08.992Z", | ||
"roles": [ | ||
"admin", | ||
"user", | ||
"bot" | ||
], | ||
"lastLogin": "2018-03-09T20:15:20.019Z", | ||
"statusConnection": "online", | ||
"utcOffset": -3, | ||
"username": "rocket.cat", | ||
"settings": { | ||
"profile": {} | ||
} | ||
}, | ||
"success": true | ||
} | ||
``` | ||
|
||
## Change Log | ||
|
||
| Version | Description | | ||
| :--- | :--- | | ||
| 0.62.2 | Added as `user.updateOwnBasicInfo` | |