Update a MalOp Label
Endpoint URL: https://<your server>/rest/detection/update-labels
Endpoint URI: detection/update-labels
Action: POST
Updates an existing MalOp label from the list of labels available for use to add to MalOps.
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
{
"malopGuids":["<guid>"],
"addedLabels":["<label ID>"],
"removedLabels":["<label ID>"]
}
Request Parameters
URL/URI parameters: none
Request Body Parameters: Add the following as necessary:
malopGuids: A list of MalOp GUIDs that include the MalOp label.
addedLabels: A list of strings (each label in quotes) for labels to add.
removedLabels: A list of integer values with the label IDs to delete.
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 a message reporting success.
Response Failure Schema
The response contains a message containing a message on the failure.
Important Response Fields
The response contains a single line about the update operation. Read the status to see if the update succeeded.
Example: Update a MalOp label
Request
curl --request GET \
--url https://12.34.56.78/rest/detection/update-label \
--header 'Content-Type:application/json' \
--data '{
"malopGuids":["AAAA07FM9Ng3ue6M"],
"addedLabels":["24"],
"removedLabels":["63"]
}'
Response
{"success"}
Request
Use this request body:
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:
{
"malopGuids":["AAAA07FM9Ng3ue6M"],
"addedLabels":["24"],
"removedLabels":["63"]
}
Response
{"success"}
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 = "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/detection/update-labels"
api_url = base_url + endpoint_url
api_headers = {'Content-Type':'application/json'}
# These are the parameters for the request.
malop_id = "AAAA07FM9Ng3ue6M"
add_label_1 = "24"
removedLabels = "63"
query = json.dumps({"malopGuids":[malop_id],"addedLabels":[add_label_1],"removedLabels":[removedLabels]})
api_response = session.request("POST", api_url, data=query, headers=api_headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
{"success"}