Add to group¶
POST/
Endpoint API · Endpoint Groups Management
Add endpoints to your group.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
groupId | path | string (uuid) | Yes | Endpoint group ID. |
Request body¶
Content type: application/json
Request body fields
idsarray of string (uuid)requiredList of endpoint IDs.
Must contain at most 1000 items. Items must be unique.
Must contain at most 1000 items. Items must be unique.
Request samples¶
curl -X POST "https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/<groupId>/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\",
\"f0316f62-6ce7-4008-99c5-6a1c209ab494\",
\"03e3b79e-b482-4e24-9166-b61a7eaa68b2\",
\"7cd499ea-c7d9-4186-9859-a3c10b87c042\"
]
}"
import requests
response = requests.post(
"https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/<groupId>/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',
'f0316f62-6ce7-4008-99c5-6a1c209ab494',
'03e3b79e-b482-4e24-9166-b61a7eaa68b2',
'7cd499ea-c7d9-4186-9859-a3c10b87c042']},
)
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",
"f0316f62-6ce7-4008-99c5-6a1c209ab494",
"03e3b79e-b482-4e24-9166-b61a7eaa68b2",
"7cd499ea-c7d9-4186-9859-a3c10b87c042"
]
}'
Invoke-RestMethod -Method POST -Uri "https://api-<data-region>.central.sophos.com/endpoint/v1/endpoint-groups/<groupId>/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/<groupId>/endpoints", strings.NewReader(`{
"ids": [
"e6a03d34-a943-45b7-8de3-deaf38864be4",
"b7e5f3aa-a7c6-43c6-a65e-3cd52008464b",
"f0316f62-6ce7-4008-99c5-6a1c209ab494",
"03e3b79e-b482-4e24-9166-b61a7eaa68b2",
"7cd499ea-c7d9-4186-9859-a3c10b87c042"
]
}`))
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/<groupId>/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",
"f0316f62-6ce7-4008-99c5-6a1c209ab494",
"03e3b79e-b482-4e24-9166-b61a7eaa68b2",
"7cd499ea-c7d9-4186-9859-a3c10b87c042"
]
}),
});
const data = await response.json();
console.log(data);
Responses¶
201 — Endpoints added to the specified group.¶
Response fields
addedEndpointsarray of objectEndpoints added.
Reference to an endpoint.
Show child attributesHide child attributes
idstring (uuid)requiredUnique endpoint ID.
hostnamestringEndpoint hostname.
errorsobjectCan't add endpoints to a group.
Show child attributesHide child attributes
endpointsNotFoundarray of string (uuid)endpointsOfWrongTypearray of string (uuid)Errors¶
| Status | Meaning |
|---|---|
404 | Group or at least one endpoint in the request 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.