Deleting a workload

Workloads can be deleted from Acronis Cyber Protect Cloud by sending a DELETE request to the /api/workload_management/v5/workloads endpoint using the query parameters described in this section.

Query parameters

Parameter

Type

Description

workload_id

string

Filter by one or more workload IDs. Maximum 100 items.

To filter by one workload ID, specify a workload ID: 2f4b84d8-6aad-487b-b0b1-40845bf72737.

To filter by multiple workload IDs, specify workloads in the following format: or(2f4b84d8-6aad-487b-b0b1-40845bf72737,c70134c4-a244-4b22-99ad-e081301f7530).

Response structure

If the workloads were deleted successfully, the response returns status 204 without payload.

Step-by-step procedure

  1. 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...'}
    
  2. Define a variable named params, and then assign an object with the workload_id parameter to delete one or more workloads by IDs to this variable:

    >>> params = {
    ...     # Include workload attributes in the response
    ...     "workload_id": "54f3318a-6e72-49d7-b94f-b9909df96d16"
    ... }
    
  3. Send a DELETE request to the /api/workload_management/v5/workloads endpoint:

    >>> response = requests.delete(
    ...     f'{base_url}/api/workload_management/v5/workloads',
    ...     headers=auth,
    ...     params=params,
    ... )
    
  4. Check the status code of the response:

    >>> response.status_code
    204
    

    Status code 204 means that the workloads were deleted successfully.