RestService :: terminateWorkflow: Bitrix method

      
<?php 
//  Bitrix\Bizproc\RestService :: terminateWorkflow()
//  /dist/bitrix/modules/bizproc/lib/restservice.php:615

    
public static function terminateWorkflow($params$n$server)
    {
        
self::checkAdminPermissions();
        
$params array_change_key_case($paramsCASE_UPPER);

        if (empty(
$params['ID']))
        {
            throw new 
RestException('Empty workflow instance ID'self::ERROR_WRONG_WORKFLOW_ID);
        }

        
$id $params['ID'];
        
$status = isset($params['STATUS']) ? (string)$params['STATUS'] : '';
        
$errors = [];

        if (!\
CBPDocument::terminateWorkflow($id, [], $errors$status))
        {
            throw new 
RestException($errors[0]['message']);
        }

        return 
true;
    }