Remove a Sensor From a Group
Endpoint URL: https://<your server>/rest/sensors/action/removeFromGroup
Endpoint URI: sensors/action/removeFromGroup
Action: POST
Removes a sensor from a sensor group. You must have the System Admin role to run this request.
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
Input: JSON
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.
{
"filters":null,
"sensorsIds":["<sensor id>"]
}
Request Parameters
URL/URI parameters: none
Request Body Parameters: Use these request parameters. Required parameters are noted in bold. Ensure that you add the sensorsIds parameter OR the filters parameter but not both.
sensorsIds: A string value with the pylum IDs for the sensor to remove from a group. If you do not assign a specific sensor pylum ID value, this request removes all the sensors from this group.
Note
When you remove a sensor from a group, the sensor is automatically assigned to the unassigned group.
You can use a number of optional parameters in the filters object. If you do not add filters, add the value null for the filters object.
Note
If you add a parameter in the filters object, ensure you use this syntax: {“fieldName”: “<filter parameter>”, “operator”: “<operator>”, “values”: [“<value>”]}
Response Status Codes
This request can return the following status codes:
200: Success OK or an error message saying why
400: Error with description for incorrect domain name for a sensor or missing tag name
Response Success Schema
The response contains the following fields:
numberOfSensorsMatchedCriteria: An integer value that shows how many sensors matched the specified criteria.
numberOfSensorsAssigned: The number of sensors removed from the specified group.
Response Failure Schema
A 400 error code with an error message describing the error.
Important Response Fields
Important information is found in these fields:
numberOfSensorsAssigned: The number of sensors successfully removed from the selected group.
Example: Remove a sensor from a group
Request
curl --request POST \
--url https://12.34.56.78/rest/sensors/action/removeFromGroup \
--header 'Content-Type:application/json' \
--data '{
"filters":null,
"sensorsIds":["5f1d70c2e4b0f2283bfcbe33:europe1"]
}'
Response
{
"numberOfSensorsMatchedCriteria":1,
"numberOfSensorsRemoved":1
}
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.
Use this request body:
{
"filters":null,
"sensorsIds":["5f1d70c2e4b0f2283bfcbe33:europe1"]
}
Response
{
"numberOfSensorsMatchedCriteria":1,
"numberOfSensorsRemoved":1
}
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""
endpoint_url = "/rest/sensors/action/removeFromGroup"
api_url = base_url + endpoint_url
# These are the variables that represent different fields in the request.
sensor_id = "5f1d70c2e4b0f2283bfcbe33:europe1"
null = None
query = json.dumps({"sensorsIds":[sensor_id],"filters":null})
api_response = session.request("POST", api_url, data=query, headers=headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
{
"numberOfSensorsMatchedCriteria":1,
"numberOfSensorsRemoved":1
}