Fuselage
Powered By GitBook
Update settings
Updates the setting for the provided _id.
The _id of a setting is the first argument of the RocketChat.settings.add method used in Rocket.Chat/packages/rocketchat-lib/server/startup/settings.js (among other files). For example, the following code in that settings.js file
1
this.add('Accounts_AllowAnonymousRead', false, {
2
type: 'boolean',
3
public: true
4
});
Copied!
means that the setting labeled "Allow anonymous read" in the section "Accounts" has _id equal to 'Accounts_AllowAnonymousRead'. The second argument is the default value (false). The third argument specifies the variable's type and whether it is public, hidden, and so on. To set a color, you can send
1
{
2
value: '<color-code>',
3
editor: 'color'
4
}
Copied!
And also to trigger a action-button use:
1
{
2
execute: true
3
}
Copied!
URL
Requires Auth
HTTP Method
/api/v1/settings/:_id
yes
POST

Payload

Argument
Example
Required
Description
_id
Livechat_enabled
Required
The setting's _id field
value
true
Required
The value to update the setting.
color
<color-code>
Optional
The color code to update the setting.
editor
true
Required if color was set
The editor key, with color value.
execute
true
Optional
To trigger a action-button

Example Call

1
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
2
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
3
-H "Content-type:application/json" \
4
http://localhost:3000/api/v1/settings/Livechat_enabled \
5
-d '{ "value": true }'
Copied!

Example Result

1
{
2
"success": true
3
}
Copied!

Example Call

Setting a color
1
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
2
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
3
-H "Content-type:application/json" \
4
http://localhost:3000/api/v1/settings/Livechat_enabled \
5
-d '{ "value": "#ffffff", "editor": "color"}'
Copied!

Example Result

1
{
2
"success": true
3
}
Copied!

Example Call

Trigger an action
1
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
2
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
3
-H "Content-type:application/json" \
4
http://localhost:3000/api/v1/settings/Livechat_enabled \
5
-d '{ "value": "method", "execute": true}'
Copied!

Example Result

1
{
2
"success": true
3
}
Copied!

Change Log

Version
Description
0.65.0
Added option to set a color and trigger an action
0.42.0
Added
Last modified 6mo ago