Retrieve a List of Sensor Policies
Endpoint URL: https://<your server>/rest/policies
Endpoint URI: policies
Action: GET
Retrieves a list of sensor policies.
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
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 with a success or failure message.
Response Success Schema
The response includes:
Field |
Type |
Description |
---|---|---|
id |
String |
The unique identifier the Cybereason platform uses for the sensor policy. |
name |
String |
The name for the policy. |
description |
String |
A description of the policy. |
createdBy |
String |
The Cybereason user name for the user that created the policy. |
creationTime |
Long |
The time (in milliseconds) when the policy was created. |
lastEditedBy |
String |
The Cybereason user name for the user that last created the policy. |
lastEditedTime |
Long |
The time (in milliseconds) when the policy was last edited. |
assignedSensors |
Integer |
The number of sensors to which this policy is assigned. |
isDefault |
Boolean |
Indicates whether this is the default policy for the Cybereason environment. |
nonCompliantSensors |
Integer |
The number of sensors marked as non-compliant with the policy settings. |
assignedGroupIds |
Array |
A collection of group IDs to which the policy is associated. |
groupId |
String |
The group ID for the policy. |
Response Failure Schema
None
Important Response Fields
Important information is found in these fields:
id: The unique identifier the Cybereason platform uses for the policy. This ensures that the policy is created.
name: The name for the policy.
Example: Retrieve details for a sensor policy
Request
curl --request GET \
--url https://12.34.56.78/rest/policies \
--header 'Content-Type:application/json' \
Response
{
"policies":[
{
"id":"c24518b3-799d-41fe-8520-c55bed63aafc",
"name":"R&D",
"description":"Policy for endpoint belonging to Sales Team",
"createdBy":"[email protected]",
"creationTime":1570451384828,
"lastEditedBy":"[email protected]",
"lastEditedTime":1630411211018,
"assignedSensors":1,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":["e9ce9a2b-f084-4938-8690-44e0edeaf633","dcddce72-71f1-438a-aaca-90ec3c6a338b"],
"groupId":""
},
{
"id":"043b69d2-d193-4a2e-97e2-8011edda112d",
"name":"Default",
"description":"",
"createdBy":"Admin",
"creationTime":1565007551297,
"lastEditedBy":"[email protected]",
"lastEditedTime":1632852249321,
"assignedSensors":0,
"isDefault":true,
"nonCompliantSensors":0,
"assignedGroupIds":["083e6443-aacb-43f6-b9aa-ffc494ccb84e"],
"groupId":""
},
{
"id":"d0be8e9c-35b0-4994-89e8-c70dd0ec147c",
"name":"EPP",
"description":"",
"createdBy":"[email protected]",
"creationTime":1611696489868,
"lastEditedBy":"[email protected]",
"lastEditedTime":1635760532357,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":[],
"groupId":""
},
{
"id":"1ff1520f-e298-41cf-8ed9-acf20ba271b6",
"name":"Ransomware & EPP",
"description":"For EPP/Ransomware Demonstrations",
"createdBy":"[email protected]",
"creationTime":1624634645421,
"lastEditedBy":"[email protected]",
"lastEditedTime":1624997676490,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":[],
"groupId":""
},
{
"id":"e22c0290-809e-4dc8-a47c-04be00b04a91",
"name":"Sales",
"description":"Policy for endpoint belonging to Sales Team",
"createdBy":"[email protected]",
"creationTime":1565710042890,
"lastEditedBy":"[email protected]",
"lastEditedTime":1611684175376,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":["bccb2aca-c774-4bff-996e-c0a5ca7ecae8"],
"groupId":""
}
],
"total":5
}
Request
Response
{
"policies":[
{
"id":"c24518b3-799d-41fe-8520-c55bed63aafc",
"name":"R&D",
"description":"Policy for endpoint belonging to Sales Team",
"createdBy":"[email protected]",
"creationTime":1570451384828,
"lastEditedBy":"[email protected]",
"lastEditedTime":1630411211018,
"assignedSensors":1,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":["e9ce9a2b-f084-4938-8690-44e0edeaf633","dcddce72-71f1-438a-aaca-90ec3c6a338b"],
"groupId":""
},
{
"id":"043b69d2-d193-4a2e-97e2-8011edda112d",
"name":"Default",
"description":"",
"createdBy":"Admin",
"creationTime":1565007551297,
"lastEditedBy":"[email protected]",
"lastEditedTime":1632852249321,
"assignedSensors":0,
"isDefault":true,
"nonCompliantSensors":0,
"assignedGroupIds":["083e6443-aacb-43f6-b9aa-ffc494ccb84e"],
"groupId":""
},
{
"id":"d0be8e9c-35b0-4994-89e8-c70dd0ec147c",
"name":"EPP",
"description":"",
"createdBy":"[email protected]",
"creationTime":1611696489868,
"lastEditedBy":"[email protected]",
"lastEditedTime":1635760532357,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":[],
"groupId":""
},
{
"id":"1ff1520f-e298-41cf-8ed9-acf20ba271b6",
"name":"Ransomware & EPP",
"description":"For EPP/Ransomware Demonstrations",
"createdBy":"[email protected]",
"creationTime":1624634645421,
"lastEditedBy":"[email protected]",
"lastEditedTime":1624997676490,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":[],
"groupId":""
},
{
"id":"e22c0290-809e-4dc8-a47c-04be00b04a91",
"name":"Sales",
"description":"Policy for endpoint belonging to Sales Team",
"createdBy":"[email protected]",
"creationTime":1565710042890,
"lastEditedBy":"[email protected]",
"lastEditedTime":1611684175376,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":["bccb2aca-c774-4bff-996e-c0a5ca7ecae8"],
"groupId":""
}
],
"total":5
}
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/policies"
api_url = base_url + endpoint_url
api_response = session.request("GET", api_url, headers=headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
{
"policies":[
{
"id":"c24518b3-799d-41fe-8520-c55bed63aafc",
"name":"R&D",
"description":"Policy for endpoint belonging to Sales Team",
"createdBy":"[email protected]",
"creationTime":1570451384828,
"lastEditedBy":"[email protected]",
"lastEditedTime":1630411211018,
"assignedSensors":1,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":["e9ce9a2b-f084-4938-8690-44e0edeaf633","dcddce72-71f1-438a-aaca-90ec3c6a338b"],
"groupId":""
},
{
"id":"043b69d2-d193-4a2e-97e2-8011edda112d",
"name":"Default",
"description":"",
"createdBy":"Admin",
"creationTime":1565007551297,
"lastEditedBy":"[email protected]",
"lastEditedTime":1632852249321,
"assignedSensors":0,
"isDefault":true,
"nonCompliantSensors":0,
"assignedGroupIds":["083e6443-aacb-43f6-b9aa-ffc494ccb84e"],
"groupId":""
},
{
"id":"d0be8e9c-35b0-4994-89e8-c70dd0ec147c",
"name":"EPP",
"description":"",
"createdBy":"[email protected]",
"creationTime":1611696489868,
"lastEditedBy":"[email protected]",
"lastEditedTime":1635760532357,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":[],
"groupId":""
},
{
"id":"1ff1520f-e298-41cf-8ed9-acf20ba271b6",
"name":"Ransomware & EPP",
"description":"For EPP/Ransomware Demonstrations",
"createdBy":"[email protected]",
"creationTime":1624634645421,
"lastEditedBy":"[email protected]",
"lastEditedTime":1624997676490,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":[],
"groupId":""
},
{
"id":"e22c0290-809e-4dc8-a47c-04be00b04a91",
"name":"Sales",
"description":"Policy for endpoint belonging to Sales Team",
"createdBy":"[email protected]",
"creationTime":1565710042890,
"lastEditedBy":"[email protected]",
"lastEditedTime":1611684175376,
"assignedSensors":0,
"isDefault":false,
"nonCompliantSensors":0,
"assignedGroupIds":["bccb2aca-c774-4bff-996e-c0a5ca7ecae8"],
"groupId":""
}
],
"total":5
}