Change group membership¶
POST/
Endpoint API · Endpoint Groups Management
Move endpoints to a group, or remove them from their current groups when groupId is null.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
Request body¶
Content type: application/json
Request body fields
groupIdstring (uuid)requiredID of the target endpoint group. Set to a UUID to assign endpoints to that group, or null to remove endpoints from their current group.
idsarray of string (uuid)requiredList of up to 500 endpoint IDs.
Must contain at most 500 items. Items must be unique.
Must contain at most 500 items. Items must be unique.
Request samples¶
curl -X POST "https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/endpoints" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"ids\": [
\"e6a03d34-a943-45b7-8de3-deaf38864be4\",
\"b7e5f3aa-a7c6-43c6-a65e-3cd52008464b\"
],
\"groupId\": \"1d6d4a8b-551c-4a53-9708-f52773de3a5b\"
}"
import requests
response = requests.post(
"https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/endpoints",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={ 'ids': [ 'e6a03d34-a943-45b7-8de3-deaf38864be4',
'b7e5f3aa-a7c6-43c6-a65e-3cd52008464b'],
'groupId': '1d6d4a8b-551c-4a53-9708-f52773de3a5b'},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"ids": [
"e6a03d34-a943-45b7-8de3-deaf38864be4",
"b7e5f3aa-a7c6-43c6-a65e-3cd52008464b"
],
"groupId": "1d6d4a8b-551c-4a53-9708-f52773de3a5b"
}'
Invoke-RestMethod -Method POST -Uri "https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/endpoints" -Headers $headers -Body $body -ContentType "application/json"
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, err := http.NewRequest("POST", "https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/endpoints", strings.NewReader(`{
"ids": [
"e6a03d34-a943-45b7-8de3-deaf38864be4",
"b7e5f3aa-a7c6-43c6-a65e-3cd52008464b"
],
"groupId": "1d6d4a8b-551c-4a53-9708-f52773de3a5b"
}`))
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/endpoint/v1/endpoint-groups/endpoints", {
method: "POST",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"ids": [
"e6a03d34-a943-45b7-8de3-deaf38864be4",
"b7e5f3aa-a7c6-43c6-a65e-3cd52008464b"
],
"groupId": "1d6d4a8b-551c-4a53-9708-f52773de3a5b"
}),
});
const data = await response.json();
console.log(data);
Responses¶
200 — Success.¶
Response fields
itemsarray of objectEndpoints whose group membership changed.
Reference to an endpoint.
Show child attributesHide child attributes
idstring (uuid)requiredUnique endpoint ID.
hostnamestringEndpoint hostname.
errorsarray of objectEndpoints whose group membership could not be changed.
Error details for an endpoint action request that could not be accepted for a specific endpoint.
Show child attributesHide child attributes
idstring (uuid)requiredThe endpoint id.
errorCodestringrequiredMachine-readable error code for an endpoint action request. The errorMessage field of the error response will contain a human-readable description of the error.
Must be one of:
Must be one of:
notFound, notSupported, conflict, permissionDenied, internalError.endpointErrorCodestringOptional code that maps to an error message.
errorMessagestringrequiredA human-readable error message describing the error in more detail.
Must be at most 250 characters long.
Must be at most 250 characters long.
Errors¶
| Status | Meaning |
|---|---|
404 | Resource not found. |
409 | You can't modify groups synced from Active Directory. You also can't use this API to add endpoints synced from Active Directory to a group. |
500 | Internal server error. |
All error responses share the same shape — see the error response object.
See the guide for a narrative walkthrough of this API.