Skip to content

Update group

Endpoint

PUT /organizations/{org_id}/groups/{group_id}

This endpoint updates the details (name, description) and/or the membership (members, guests) of an existing group.

Request

Replace {org_id} with your Organization ID and {group_id} with the ID of the group to update.

Headers

  • Authorization: Bearer {your_access_token}
  • Accept: application/json
  • X-Tallyfy-Client: APIClient
  • Content-Type: application/json

Body (JSON)

The request body requires a JSON object containing the group properties you wish to modify. You only need to include the fields you want to change.

Refer to the #definitions/createGroupInput schema (often similar to update) in Swagger. Key fields:

  • name (string): New name for the group.
  • description (string): New description.
  • members (array of integers): Replaces the current list of member IDs in the group.
  • guests (array of strings): Replaces the current list of guest emails in the group.

Example Body (Updating name and members):

{
"name": "Project Alpha Core Team",
"members": [1001, 1008, 1010] // User 1005 removed, 1008/1010 added
}

Code Samples

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const groupId = 'GROUP_ID_TO_UPDATE';
const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/groups/${groupId}`;
const updateData = {
description: "Updated team description.",
// Example: Set specific members (replaces existing)
members: [1001, 1003, 1005],
guests: [] // Remove all guests from this group
};
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
headers.append('Content-Type', 'application/json');
fetch(apiUrl, {
method: 'PUT',
headers: headers,
body: JSON.stringify(updateData)
})
.then(response => {
if (!response.ok) {
// Error handling...
return response.json().then(errData => { throw new Error(/*...*/); }).catch(() => { throw new Error(/*...*/); });
}
return response.json();
})
.then(data => {
console.log(`Successfully updated group ${groupId}:`);
console.log(JSON.stringify(data, null, 2));
})
.catch(error => {
console.error(`Error updating group ${groupId}:`, error);
});

Response

A successful request returns a 200 OK status code and a JSON object containing the full details of the group after the update.

{
"data": {
"id": "GROUP_ID_TO_UPDATE",
"name": "Project Alpha Core Team", // Updated name
"description": "Updated team description.", // Updated description
"members": [1001, 1008, 1010], // Updated members list
"guests": [], // Updated guests list
// ... other group properties ...
"updated_at": "2024-05-21T19:00:00Z" // Reflects update time
}
}

If the group ID is not found, you lack permission, or the request body is invalid, an appropriate error status code (404, 403, 400, 422) will be returned.