Activating an integration
Before you start
Authenticate to the Acronis cloud platform via the Python shell.
These variables should be available:
>>> base_url # the base URL of the API '<your Acronis data center URL>/api/integration_management/v2' >>> auth # the 'Authorization' header value with the access token {'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImMwMD...'} >>> tenant_id # the UUID of the tenant to which the token provides access 'ede9f834-70b3-476c-83d9-736f9f8c7dae'
Define these common variables, which describe the integration and will be used in status reporting requests:
>>> # Replace '<vendor.application>' with your application code >>> application_code = '<vendor.application>' >>> module = {'name': 'Integration backend', 'version': '1.0.0'} >>> vendor_system = {'name': 'Product integrated with Acronis', 'version': '22.04.1'}
To activate an integration
Define a variable named
status
, and then assign a dictionary with information about the integration status to this variable:>>> status = { ... 'application_code': application_code, ... 'module': module, ... 'vendor_system': vendor_system, ... 'events': [{'category': 'activation', 'action': 'activated integration', 'activation_event': True}], ... }
[Optional] Define the
target_tenant_id
variable and specify the tenant UUID where you want to report the integration activation:>>> target_tenant_id = tenant_id
Convert the
status
object to a JSON text:>>> status = json.dumps(status, indent=4)
Send a POST request with the JSON text to the
/status?tenantID={target_tenant_id}
endpoint:>>> response = requests.post( ... f'{base_url}/status?tenantID={target_tenant_id}', ... headers={'Content-Type': 'application/json', **auth}, ... data=status, ... )
Check the status code of the response:
>>> response.status_code 204
Status code 204 means that the integration has been activated.