Deleting all protection plans for a tenant

To delete all protection plans for a tenant

  1. Authenticate to the cloud platform via the Python shell.

    The following variables should be available now:

    >>> base_url  # the base URL of the API
    'https://eu2-cloud.acronis.com/api'
    >>> auth  # the 'Authorization' header value with the access token
    {'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImMwMD...'}
    
  2. Define a variable named filters, and then assign an object containing the ID of the tenant where plans need to be deleted to this variable:

    >>> filters = {
    ...     'tenant_id': '16'
    ... }
    

    Note

    For the list of available query string parameters, see the Resource and Policy Management API reference.

  3. Send a DELETE request to the /policy_management/v4/policies endpoint:

    >>> response = requests.delete(
    ...     f'{base_url}/policy_management/v4/policies',
    ...     headers=auth,
    ...     params=filters,
    ... )
    
  4. Check the status code of the response:

    >>> response.status_code
    204
    

    Status code 204 means that all protection plans for the specified tenant have been successfully deleted.

    Note

    A different status code means that an error has occurred. For details of the error, see HTTP status response codes and API error codes.