Skip to content
This repository was archived by the owner on Mar 17, 2023. It is now read-only.

[NEW] Added docs to users.updateOwnBasicInfo endpoint #632

Merged
merged 2 commits into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
- setAvatar
- set-preferences
- update
- updateOwnBasicInfo
- Offset and Count and Sort Info
- Permissions
- Query and Fields Info
Expand Down
2 changes: 1 addition & 1 deletion contributing/documentation/documentation-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ Here you can also find what articles are incomplete and missing.
- Im:
- close
- <span class="missing">[files](../missing-and-outdated-list/index.html#imfiles)</span>

- history
- list.everyone
- list
Expand Down Expand Up @@ -360,6 +359,7 @@ Here you can also find what articles are incomplete and missing.
- setAvatar
- setPreferences
- update
- updateOwnBasicInfo
- Offset and Count and Sort Info
- Permissions
- Query and Fields Info
Expand Down
1 change: 1 addition & 0 deletions developer-guides/rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/users.resetAvatar` | Reset a user's avatar | [Link](users/resetavatar/) |
| `/api/v1/users.setAvatar` | Set a user's avatar | [Link](users/setavatar/) |
| `/api/v1/users.update` | Update an existing user. | [Link](users/update/) |
| `/api/v1/users.updateOwnBasicInfo` | Update basic information of own user. | [Link](users/updateownbasicinfo/) |
| `/api/v1/users.getPreferences` | Gets all preferences of user. | [Link](users/get-preferences/) |
| `/api/v1/users.setPreferences` | Set user's preferences | [Link](users/set-preferences/) |

Expand Down
1 change: 1 addition & 0 deletions developer-guides/rest-api/users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
| `/api/v1/users.resetAvatar` | Reset a user's avatar | [Link](resetavatar/) |
| `/api/v1/users.setAvatar` | Set a user's avatar | [Link](setavatar/) |
| `/api/v1/users.update` | Update an existing user. | [Link](update/) |
| `/api/v1/users.updateOwnBasicInfo` | Update basic information of own user.| [Link](updateownbasicinfo/) |
105 changes: 105 additions & 0 deletions developer-guides/rest-api/users/updateownbasicinfo/README.md
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` |