Fetching workloads
A list of workloads that are present in Acronis Cyber Protect Cloud may be obtained by sending a GET request to the /api/workload_management/v5/workloads
endpoint.
Query parameters
Parameter |
Type |
Description |
---|---|---|
|
string |
|
|
string |
|
|
string |
|
|
string |
|
|
string |
|
|
boolean |
If true, includes workload statuses in the response. Does not include workload statuses otherwise. |
|
boolean |
If true, includes all workload attributes in the response. Does not include workload attributes otherwise. Mutually exclusive with the |
|
array of string |
Includes the specified workload attributes (if present) by their names in the response. Mutually exclusive with the |
|
boolean |
If true, includes allowed actions for the workload in the response. Does not include workload actions otherwise. |
|
boolean |
If true, includes aspects that were aggregated into the workload. |
|
string |
|
|
integer |
Number of the results returned in the response. |
|
string |
Cursor to the previous results page. |
|
string |
Cursor to the next results page. |
Response structure
If the workloads were fetched successfully, the response returns status 200 with the payload in the following structure:
Name |
Value type |
Description |
---|---|---|
|
array of object |
A list of workloads. |
|
string |
The UUID of the workload. |
|
string |
The identifier of the workload type. |
|
string |
A name of the workload. |
|
object |
A key-value map of workload attributes. Allowed values are defined by the attributes schema specified in the Vendor Portal. |
|
string |
An identifier of the API client that created the workload. Must be the client ID of your application. |
|
array of string |
A list of workload action identifiers that are allowed for this workload. |
|
string |
The identifier of the tenant where the workload was created. |
|
string |
The identifier that is used in the external system where the workload is originated from. Equal to the |
|
string |
UUID of the agent that manages the workload. Only applicable to Acronis workloads. |
|
string |
RFC3339 date and time in UTC timezone when the workload was created. |
|
string |
RFC3339 date and time in UTC timezone when the workload was updated. |
|
object |
Parameters of any use cases when workload group is automatically created. |
|
array of objects |
Parameters of any use cases when the parent-child relationship is set automatically. |
|
boolean |
True if the workload was created due to merge and cluster-like use case. False otherwise. |
|
string |
|
|
boolean |
Status of the workload. True if enabled, false otherwise. |
|
object |
An object containing the information about the pagination. |
|
object |
An object containing the information about the cursors to the pages. |
|
string |
Cursor to the next page. |
|
string |
Cursor to the previous page. |
|
array of object |
A list of links related to the requested resource. |
Step-by-step procedure
Authenticate to the cloud platform via the Python shell.
The following variables should be available now:
>>> base_url # the base URL 'https://eu8-cloud.acronis.com' >>> auth # the 'Authorization' header value with the access token {'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImMwMD...'}
Define a variable named
params
, and then assign an object with theinclude_all_attributes
parameter to include all workload attributes to this variable:>>> params = { ... # Include workload attributes in the response ... "include_all_attributes": True ... }
Send a GET request to the
/api/workload_management/v5/workloads
endpoint:>>> response = requests.get( ... f'{base_url}/api/workload_management/v5/workloads', ... headers=auth, ... params=params, ... )
Check the status code of the response:
>>> response.status_code 200
Status code 200 means that the request was successful.
Also, the response body contains the list of workloads including all their attributes in the
attributes
field formatted as a JSON text. When converted to an object, it will look as follows:>>> pprint.pprint(response.json()) { "items": [ { "type_alias": "resource.machine", "aggregates_detection_query": {}, "parent_child_relationship_query": [ { "parent_type": "cti.a.p.wm.workload.v1.0~a.p.wm.group.v1.0~a.p.computers.v1.0" } ], "id": "2faf3f5c-0d7a-455f-bcf1-6fb7b8ec1bf2", "created_at": "2023-11-07T14:40:01.976227998Z", "updated_at": "2023-11-07T14:40:01.976227998Z", "type": "cti.a.p.wm.workload.v1.0~a.p.wm.aspect.v1.0~vendor.application.mongodb.v1.0", "is_auto_created": false, "external_id": "2faf3f5c-0d7a-455f-bcf1-6fb7b8ec1bf2@286", "tenant_id": "286", "name": "MongoDB Server", "user_defined_name": "MongoDB Server", "attributes": { "host_name": "DESKTOP-ABC321SDF", "mac_address": "00:00:00:00:00", "status": "OK", "db_version": "v3.4.9" }, "client_id": "696fcfe0-1272-454c-99cc-24ec2e037613", "aggregation_status": "NOT_AGGREGATED" }, ... ], "paging": { "cursors": { "total": 3 } }, "dynamic_group_creation_forbidden": false, "_links": [ { "rel": "self", "href": "/api/workload_management/v5/workloads" } ] }