0

Update Group

by
Published Oct 17, 2025

Updates the Group specified in the URL. **_This operation is only available to group administrators and system administrators._**

Script smartsheet Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Smartsheet = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * Update Group
8
 * Updates the Group specified in the URL.
9

10
**_This operation is only available to group administrators and system administrators._**
11

12
 */
13
export async function main(
14
  auth: Smartsheet,
15
  groupId: string,
16
  body: { name?: string; description?: string; ownerId?: number },
17
) {
18
  const url = new URL(`${auth.baseUrl}/groups/${groupId}`);
19

20
  const response = await fetch(url, {
21
    method: "PUT",
22
    headers: {
23
      "Content-Type": "application/json",
24
      Authorization: "Bearer " + auth.token,
25
    },
26
    body: JSON.stringify(body),
27
  });
28
  if (!response.ok) {
29
    const text = await response.text();
30
    throw new Error(`${response.status} ${text}`);
31
  }
32
  return await response.json();
33
}
34