Retrieve Sensor Groups
Endpoint URL: https://<your server>/rest/groups
Endpoint URI: groups
Action: GET
Retrieves a list of sensor groups. You must have the System Admin role to perform 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
None
Request Parameters
URL/URI parameters: None
Request Body Parameters: none
Response Status Codes
This request can return the following status codes:
200: Success OK
Response Success Schema
The response includes the following fields:
Field |
Type |
Description |
---|---|---|
id |
String |
The unique identifier used by the Cybereason platform for the group. |
name |
String |
The name given for the group on creation of the group. |
description |
String |
The description given for the group on creation of the group. |
creationTime |
Integer |
The time (in epoch) when the group was created. |
lastUpdate |
Integer |
The time (in epoch) when the name or description of the group was updated. |
updatedByUser |
String |
The Cybereason user name of the user who last updated the group details. |
groupAssignRule |
Array |
An object containing details on automatic assignment rules for the sensor group. This field is available from version 20.2.20 and later versions. |
ruleType |
String |
The type of criteria used for the automatic assignment. This field is available from versions 20.2.20 and later versions. |
ruleOperator |
Enum |
The operator used for matching the criteria. This field is available from versions 20.2.20 and later versions. |
ruleValues |
Array |
An object containing a collection of values used for matching sensors to the rule. This field is available from versions 20.2.20 and later versions. |
policyId |
String |
The unique identifier the Cybereason platform uses for a specific sensor policy. This field is available from versions 20.2.61 and later versions. |
Response Failure Schema
None
Important Response Fields
Important information is found in these fields:
id field: The unique identifier the Cybereason platform assigns to the group. You need this ID number to edit a group name or description or to assign a sensor to the group.
name and description field: The name and description for the group.
Example: Retrieve a list of sensor groups
Request
curl --request GET \
--url https://12.34.56.78/rest/groups/ \
--header 'Content-Type:application/json' \
Response
[
{
"id":"00000000-0000-0000-0000-000000000000",
"name":"Unassigned",
"description":"",
"creationTime":1595770236915,
"lastUpdateTime":0,
"updatedByUser":"Admin",
"groupAssignRule": null,
"policyId": "c75adb73-22b9-43a5-8362-92270c61770f"
},
{
"id":"10000000-0000-0000-0000-000000000000",
"name":"USA",
"description":"",
"creationTime":1595770236915,
"lastUpdateTime":0,
"updatedByUser":"Admin",
"groupAssignRule": null,
"policyId":""
},
{
"id":"20000000-0000-0000-0000-000000000000",
"name":"Europe",
"description":"",
"creationTime":1595770236915,
"lastUpdateTime":0,"updatedByUser":"Admin",
"groupAssignRule": null,
"policyId":""
}
]
Request
Response
[
{
"id":"00000000-0000-0000-0000-000000000000",
"name":"Unassigned",
"description":"",
"creationTime":1595770236915,
"lastUpdateTime":0,
"updatedByUser":"Admin",
"groupAssignRule": null,
"policyId": "c75adb73-22b9-43a5-8362-92270c61770f"
},
{
"id":"10000000-0000-0000-0000-000000000000",
"name":"USA",
"description":"",
"creationTime":1595770236915,
"lastUpdateTime":0,
"updatedByUser":"Admin",
"groupAssignRule": null,
"policyId":""
},
{
"id":"20000000-0000-0000-0000-000000000000",
"name":"Europe",
"description":"",
"creationTime":1595770236915,
"lastUpdateTime":0,"updatedByUser":"Admin",
"groupAssignRule": null,
"policyId":""
}
]
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/groups"
api_url = base_url + endpoint_url
api_headers = {'Content-Type':'application/json'}
api_response = session.request("GET", api_url, headers=api_headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
[ { "id":"00000000-0000-0000-0000-000000000000", "name":"Unassigned", "description":"", "creationTime":1595770236915, "lastUpdateTime":0, "updatedByUser":"Admin", "groupAssignRule": null, "policyId": "c75adb73-22b9-43a5-8362-92270c61770f" }, { "id":"10000000-0000-0000-0000-000000000000", "name":"USA", "description":"", "creationTime":1595770236915, "lastUpdateTime":0, "updatedByUser":"Admin", "groupAssignRule": null, "policyId":"" }, { "id":"20000000-0000-0000-0000-000000000000", "name":"Europe", "description":"", "creationTime":1595770236915, "lastUpdateTime":0,"updatedByUser":"Admin", "groupAssignRule": null, "policyId":"" } ]