Retrieve Sensor Tags
Endpoint URL: https://<your server>/rest/tagging/get/:machineName
Endpoint URI: tagging/get/:machineName
Action: POST
Retrieves existing sensor tags for a specific sensor.
This request is available from versions 18.0 and later.
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 must provide the required fully-qualified domain name (FQDN) or machine name of the Sensor as part of the request URL.
Request Body Parameters: none
Response Status Codes
This request can return the following status codes:
200: Success OK or an error message saying why
400: Error with Bad Request INVALID SENSOR
403: Forbidden - current user does not have the correct permissions
422: Unprocessible entity - the format is correct but the content is not present
Response Success Schema
A listing of the tags in each machine that was in the request.
The response includes the following fields:
<machine name>: A string value with the same name of the machine (either the FQDN or the machine name) specified in the request.
<tag name>: The default tag name (Department, Location, Device-Type, or Critical-Asset or other custom name) added in the request.
<tag value>: The value specified in the request for the tag.
Response Failure Schema
A 200 code with a description of the error.
Important Response Fields
Important information is found in these fields:
machine name/FQDN object: The object containing the list of sensor tags for a particular machine. Objects are identified with the machine FQDN or machine name. View the values for each sensor tag.
Example: Retrieve a list of sensor tags for a machine
Request
curl --request GET \
--url https://12.34.56.78/rest/sensors/tagging/fdqn1234537/ \
--header 'Content-Type:application/json' \
Response
{
"fdqn1234537": {
"Department": "HR",
"Location": "USA",
"Device-Type": "Mac",
"Critical-Asset": "false"
}
}
Request
Response
{
"fdqn1234537": {
"Department": "HR",
"Location": "USA",
"Device-Type": "Mac",
"Critical-Asset": "false"
}
}
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
machine_name = "fdqn1234567"
endpoint_url = "/rest/tagging/get/"
api_url = base_url + endpoint_url + machine_name
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
{ "fdqn1234537": { "Department": "HR", "Location": "USA", "Device-Type": "Mac", "Critical-Asset": "false" } }