Deleting a protection plan

  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. Fetch the protection plans as described in Fetching a list of policies and protection plans, then define the policy_id variable and assign it with the ID of a protection plan. As an example, the ID of the first protection plan will be taken:

    >>> policy_id = protection_plans[0]['id']
    >>> policy_id
    5b15f6e1-88ec-4dce-b523-0e8394c0bc19
    
  3. Send a DELETE request to the /policy_management/v4/policies/{policy_id} endpoint:

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

    >>> response.status_code
    204
    

    Status code 204 means that the protection plan has been deleted.

    A different status code means that an error has occurred. For the details, refer to “Status and error codes”.