Deleting 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'
    ... }
    

    For the list of available query string parameters, refer to the 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 plans for the specified tenant have been deleted.

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