groups.Update
Overview¶
Update the "Group" of the group ID specified in the "Server Script".
Prerequisites¶
Site Administration Permission is required to update groups using this function. If you want to update a group as a user without site manager privileges, you will need to specify the API key of a user with Site Administration Permission.
Syntax¶
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| groupId | object | Yes | Specify the group ID of the target group |
| data | string | Yes | Specify the update content in JSON format |
Return Value¶
If the specified "Group" can be updated, true is returned; if not, false is returned.
Usage Examples¶
The following example updates the members of "Group" of group 100 with "User" with user ID 5 and "Dept" with department ID 3. Specify "User, User ID, Manager Permission (true/false)" if the member is a user and "Dept, Department ID, Manager Permission (true/false)" if the member is a department. All member updates will be rewritten with the specified one.
JavaScript¶
const apiKey = 'xxxxx...';
const userId = 5;
const deptId = 3;
const groupId = 100;
let groupMembers = [
`User,${userId},true`,
`Dept,${deptId},false`
];
const data = {
ApiKey: apiKey,
GroupMembers: groupMembers
};
groups.Update(groupId, JSON.stringify(data));