Add a Malop Label
Endpoint URL: https://<your server>/rest/detection/add-label
Endpoint URI: detection/add-label
Action: POST
Add a new Malop label to the list of labels available for use to add to Malops.
This request is supported for versions 20.1.43 and later.
Note
Ensure that you have logged into the Cybereason platform. For details, see Log in with the API.
Request Headers
Add a Content-Type:application/json header.
Note
If you are using cURL, add the authorization cookie details or the path to the file containing the cookie details as part of every request.
Request Body
Input: JSON
{"labelText":"<label to add>"}
Request Parameters
URL/URI parameters: none
Request Body Parameters: Add a string value for the labelText parameter containing the label text.
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:
Field |
Type |
Description |
---|---|---|
id |
Integer |
The unique string the Cybereason platform assigns to the label. |
labelText |
String |
The text used for the label. |
totalCount |
Integer |
The total number of Malops to which the label is applied. |
selectionCount |
Integer |
The number of Malops IDs added to the request as selected. The response always returns all labels for all Malops but this number reflects the Malops specifically entered. |
Response Failure Schema
None
Important Response Fields
Important information is found in these fields:
id parameter: The unique identifier the Cybereason platform uses for this label.
labelText parameter: The string you added for the label.
Example: Add a Malop label
Request
curl --request POST \
--url https://12.34.56.78/rest/detection/add-label \
--header 'Content-Type:application/json' \
--data '{"labelText":"Triaged"}'
Response
[
{
"id":1,
"labelText":"New malop",
"totalCount":17,
"selectionCount":0
},
{
"id":2,
"labelText":"Triaged",
"totalCount":80,
"selectionCount":0
}
]
Request
Response
[
{
"id":1,
"labelText":"New malop",
"totalCount":17,
"selectionCount":0
},
{
"id":2,
"labelText":"Triaged",
"totalCount":80,
"selectionCount":0
}
]
Request
Download example Python script
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 = "myserver.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()
response = session.post(login_url, data=data, verify=True)
print (response.status_code)
print (session.cookies.items())
# Request URL
endpoint_url = "/rest/detection/add-label"
api_url = base_url + endpoint_url
# These parameters enable the request to run.
label_text "Triaged"
label = json.dumps({"labelText":label_text})
api_headers = {'Content-Type':'application/json'}
api_response = session.request("POST", api_url, data=label, headers=api_headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
[
{
"id":1,
"labelText":"New malop",
"totalCount":17,
"selectionCount":0
},
{
"id":2,
"labelText":"Triaged",
"totalCount":80,
"selectionCount":0
}
]