RestService :: addProvider: Bitrix method

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

    
public static function addProvider($params$n$server)
    {
        if (
Loader::includeModule('messageservice'))
        {
            return \
Bitrix\MessageService\RestService::addSender($params$n$server);
        }

        if(!
$server->getClientId())
        {
            throw new 
AccessException("Application context required");
        }

        
self::checkAdminPermissions();
        
$params self::prepareActivityData($params);

        
self::validateProvider($params$server);

        
$params['APP_ID'] = $server->getClientId();
        
$params['APP_NAME'] = self::getAppName($params['APP_ID']);

        
$iterator RestProviderTable::getList(array(
            
'select' => array('ID'),
            
'filter' => array(
                
'=APP_ID' => $params['APP_ID'],
                
'=CODE' => $params['CODE']
            )
        ));
        
$result $iterator->fetch();
        if (
$result)
        {
            throw new 
RestException('Provider already installed!'self::ERROR_ACTIVITY_ALREADY_INSTALLED);
        }

        
$result RestProviderTable::add($params);

        if (
$result->getErrors())
            throw new 
RestException('Activity save error!'self::ERROR_ACTIVITY_ADD_FAILURE);

        return 
true;
    }