- Модуль: pull
- Путь к файлу: ~/bitrix/modules/pull/lib/rest.php
- Класс: BitrixPullRest
- Вызов: Rest::channelPublicGet
static function channelPublicGet($params, $n, CRestServer $server)
{
$params = array_change_key_case($params, CASE_UPPER);
$type = CPullChannel::TYPE_PRIVATE;
if ($params['APPLICATION'] === 'Y')
{
$clientId = $server->getClientId();
if (!$clientId)
{
throw new BitrixRestRestException("Get application public channel available only for application authorization.", "WRONG_AUTH_TYPE", CRestServer::STATUS_WRONG_REQUEST);
}
$type = $clientId;
}
$userId = (int)$params['USER_ID'];
$configParams = Array();
$configParams['TYPE'] = $type;
$configParams['USER_ID'] = $userId;
$configParams['JSON'] = true;
$config = BitrixPullChannel::getPublicId($configParams);
if (!$config)
{
throw new BitrixRestRestException("Push & Pull server is not configured", "SERVER_ERROR", CRestServer::STATUS_INTERNAL);
}
return $config;
}