Get a Download Batch Number
Endpoint URL: https://<your server>/rest/fetchfile/downloads/progress
Endpoint URI: fetchfile/downloads/progress
Action: GET
Returns details on file download operations for file download operations in progress. You will need to run another request to:
Start the download operation for the operation. For details on this request, see Start a File Download Operation.
Download the file. For details on this request, see Download a File.
This request will return all file download operations where the file has not been downloaded.
Note
Before running this request, 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 can contain any of the following fields:
Field |
Type |
Description |
---|---|---|
data |
Array |
An object containing all the details on the file download operation. |
class |
Class name |
The class required by the Cybereason server to return details on file download operations. You can ignore this field in the response. |
batchId |
Integer |
The batch for the file download operation. |
actionType |
Enum |
The action requested. For this request, this field returns FetchFile. |
initiatorUserName |
String |
The Cybereason username of the user performing the file download. |
sizeInBytes |
Integer |
The size (in bytes) of the file to download. |
fileName |
String |
The name of the file to download. |
machineName |
String |
The name of the machine from which you are downloading the file. |
hash |
String |
The file hash value for the file to download. |
startTime |
Timestamp |
The time (in epoch) when the file download operation was started. |
actionStatus |
Enum |
TBD |
timeout |
Boolean |
Indicates whether to stop the file download operation when it reaches the server’s timeout period. |
pending |
Boolean |
Indicates whether the status of this download operation is in the pending state. |
inProgress |
Boolean |
Indicates whether the status of this download operation is in the In Progress state. |
failed |
Boolean |
Indicates whether this download operation is failed. |
succeeded |
Boolean |
Indicates whether this download operation succeeded. |
Response Failure Schema
None
Important Response Fields
Important information is found in these fields:
batchId field: This number required to initiate the actual download of the file in the next request.
Example: Get a download batch number
Request
curl --request GET \ --url https://12.34.56.78/rest/fetchfile/downloads/progress \ --header 'Content-Type:application/json' \
Response
{
"data":[
{
"@class":"com.cybereason.commads.FetchFileActionProgress",
"batchId":675769080,
"actionType":"FetchFile",
"initiatorUserName":"[email protected]",
"sizeInBytes":477696,
"fileName":"powershell.exe",
"machineName":"desktop-vpg2hip",
"hash":"1d7634765bcf3050d6272cba514bdb1495bad329",
"startTime":1576697965843,
"actionStatus":"NONE",
"timeout":false,
"pending":false,
"inProgress":false,
"failed":true,
"succeeded":false
}
]
}
Request
Response
{
"data":[
{
"@class":"com.cybereason.commads.FetchFileActionProgress",
"batchId":675769080,
"actionType":"FetchFile",
"initiatorUserName":"[email protected]",
"sizeInBytes":477696,
"fileName":"powershell.exe",
"machineName":"desktop-vpg2hip",
"hash":"1d7634765bcf3050d6272cba514bdb1495bad329",
"startTime":1576697965843,
"actionStatus":"NONE",
"timeout":false,
"pending":false,
"inProgress":false,
"failed":true,
"succeeded":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
endpoint_url = "rest/fetchfile/downloads/progress"
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
{
"data":[
{
"@class":"com.cybereason.commads.FetchFileActionProgress",
"batchId":675769080,
"actionType":"FetchFile",
"initiatorUserName":"[email protected]",
"sizeInBytes":477696,
"fileName":"powershell.exe",
"machineName":"desktop-vpg2hip",
"hash":"1d7634765bcf3050d6272cba514bdb1495bad329",
"startTime":1576697965843,
"actionStatus":"NONE",
"timeout":false,
"pending":false,
"inProgress":false,
"failed":true,
"succeeded":false
}
]
}