Update group¶
PATCH/
Common API · Directory Management
Update a group.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
fields | query | array of string | No | The fields to return in a partial response. |
groupId | path | string (uuid) | Yes | Group ID. |
Request body¶
Content type: application/json
Request body fields
namestringNew group name.
Must be 1–250 characters long.
Must be 1–250 characters long.
descriptionstringNew group description.
Must be at most 1000 characters long.
Must be at most 1000 characters long.
Request samples¶
curl -X PATCH "https://api-<data-region>.central.sophos.com/common/v1/directory/user-groups/<groupId>" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"name\": \"Sophos Central Group\",
\"description\": \"Security group for Sophos Central admins\"
}"
import requests
response = requests.patch(
"https://api-<data-region>.central.sophos.com/common/v1/directory/user-groups/<groupId>",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={ 'name': 'Sophos Central Group',
'description': 'Security group for Sophos Central admins'},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"name": "Sophos Central Group",
"description": "Security group for Sophos Central admins"
}'
Invoke-RestMethod -Method PATCH -Uri "https://api-<data-region>.central.sophos.com/common/v1/directory/user-groups/<groupId>" -Headers $headers -Body $body -ContentType "application/json"
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, err := http.NewRequest("PATCH", "https://api-<data-region>.central.sophos.com/common/v1/directory/user-groups/<groupId>", strings.NewReader(`{
"name": "Sophos Central Group",
"description": "Security group for Sophos Central admins"
}`))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <access-token>")
req.Header.Set("X-Tenant-ID", "<tenant-id>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
const response = await fetch("https://api-<data-region>.central.sophos.com/common/v1/directory/user-groups/<groupId>", {
method: "PATCH",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Sophos Central Group",
"description": "Security group for Sophos Central admins"
}),
});
const data = await response.json();
console.log(data);
Responses¶
200 — Group updated.¶
Response fields
idstring (uuid)requiredGroup ID.
namestringrequiredGroup name.
displayNamestringDisplay name.
descriptionstringGroup description.
domainstringDomain name.
groupsobjectAssociated groups.
Show child attributesHide child attributes
totalintegeritemsCountintegeritemsarray of objectItems must be unique.
Group reference.
Show child attributesHide child attributes
idstring (uuid)requiredGroup ID.
namestringGroup name.
displayNamestringDisplay name.
sourceobjectrequiredSource of directory information.
Show child attributesHide child attributes
typestring (enum)requiredTypes of sources of directory information. All users and groups created using this API have the source type
Must be one of:
custom. All users and groups synchronized from Active Directory, Azure Active Directory or Google Directory have the source type activeDirectory, azureActiveDirectory or googleDirectory respectively.Must be one of:
custom, activeDirectory, azureActiveDirectory, googleDirectory.usersobjectAssociated users.
Show child attributesHide child attributes
totalintegeritemsCountintegeritemsarray of objectItems must be unique.
Reference to the user.
Show child attributesHide child attributes
idstring (uuid)requiredUser ID.
namestringUser's full name.
tenantobjectrequiredReference to a tenant.
Show child attributesHide child attributes
idstring (uuid)requiredTenant ID.
namestringTenant Name.
createdAtstring (datetime)When the group was created.
updatedAtstring (datetime)When the group was last updated.
Errors¶
| Status | Meaning |
|---|---|
404 | Group not found with given ID. |
409 | Group names must be unique. You also can't use this API to update groups synced from Active Directory. |
500 | Internal server error. |
All error responses share the same shape — see the error response object.
Response examples¶
200¶
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"displayName": "string",
"description": "string",
"domain": "string",
"groups": {
"total": 0,
"itemsCount": 0,
"items": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "string",
"displayName": "string"
}
]
},
"source": {
"type": "custom"
},
"users": {
"total": 0,
"itemsCount": 0,
"items": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "string"
}
]
},
"tenant": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "string"
},
"createdAt": "string",
"updatedAt": "string"
}