Delete Sensor Groups
Endpoint URL: https://<your server>/rest/groups/:<group ID>/?assignToGroupId=<new group ID>
Endpoint URI: groups/:<groups ID>?<new group ID>
Action: DELETE
Deletes an existing sensor group. You must have System Admin permissions to run this request.
You must be assigned the System Admin role and Sensor Admin L1 role (if your Cybereason environment uses sensor grouping) to send requests to this endpoint URL.
Note
Ensure that you have logged into the Cybereason platform. For details, see Log in with the API.
Request Headers
You must add an Content-Type:application/json header with the request.
Note
If you are using cURL, add the authorization cookie details or the path to the file with cookie details with every request.
Request Body
None
Request Parameters
URL/URI parameters: You add the string with the group ID for the new group to which to assign the sensors as part of the URL as query parameter. Use the format ?assignToGroupId=00000000-0000-0000-0000-000000000000> after the URL to assign the sensors to the default unassigned group.
Request Body Parameters: None
Response Status Codes
This request can return the following status codes:
200: Success OK or an error message saying why
Response Success Schema
The response contains the following fields:
deletedGroupId: A string containing the unique group ID the Cybereason platform uses for the sensor group.
reassignedGroupName: The name of the new group assignment for the sensors that are in the deleted group.
numberOfReassignedSensors: The number of sensors that were reassigned in this delete operation.
Response Failure Schema
None
Example: Delete an existing sensor group
Request
curl --request DELETE \
--url https://12.34.56.78/rest/groups/71fc4540-dca6-434d-a3b6-98e38c0a18d1/?assignToGroupId=00000000-0000-0000-0000-000000000000 \
--header 'Content-Type:application/json' \'
Response
{
"deletedGroupId":"71fc4540-dca6-434d-a3b6-98e38c0a18d1",
"reassignedGroupName":"Unassigned",
"numberOfReassignedSensors":0
}
Request
Response
{
"deletedGroupId":"71fc4540-dca6-434d-a3b6-98e38c0a18d1",
"reassignedGroupName":"Unassigned",
"numberOfReassignedSensors":0
}
Request
Depending on your browser settings, this linked file may open in a separate tab instead of downloading directly to your machine. If this happens, use the Save As option in your browser to save the file locally.
import requests
import json
# Login information
username = "[email protected]"
password = "mypassword"
server = "yourserver.com"
port = "443"
data = {
"username": username,
"password": password
}
headers = {"Content-Type": "application/json"}
base_url = "https://" + server + ":" + port
login_url = base_url + "/login.html"
session = requests.session()
login_response = session.post(login_url, data=data, verify=True)
print (login_response.status_code)
print (session.cookies.items())
# Request URL""
group = "71fc4540-dca6-434d-a3b6-98e38c0a18d1"
endpoint_url = "/rest/groups/"
api_url = base_url + endpoint_url + group + "/?assignToGroupId=00000000-0000-0000-0000-000000000000"
api_response = session.request("DELETE", api_url, headers=headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
{
"deletedGroupId":"71fc4540-dca6-434d-a3b6-98e38c0a18d1",
"reassignedGroupName":"Unassigned",
"numberOfReassignedSensors":0
}