Deleting all protection plans for a tenant
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...'}
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.
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, ... )
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”.