Deactivating an integration

To deactivate an integration

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

    These variables should be available:

    >>> base_url  # the base URL of the API
    '<the 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'
    
  2. 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'}
    
  3. 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': 'deactivated integration', 'deactivation_event': True}]
    ... }
    
  4. [Optional] Define the target_tenant_id variable and specify the tenant UUID where you want to report the integration deactivation:

    >>> target_tenant_id = tenant_id
    
  5. Convert the status object to a JSON text:

    >>> status = json.dumps(status, indent=4)
    
  6. 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,
    ... )
    
  7. Check the status code of the response:

    >>> response.status_code
    204
    

    Status code 204 means that the integration has been successfully deactivated.

    Note

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