PublicAction::restGateway

  1. Bitrix24 API (v. 23.675.0)
  2. landing
  3. PublicAction
  4. restGateway
  • Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/publicaction.php
  • Класс: BitrixLandingPublicAction
  • Вызов: PublicAction::restGateway
static function restGateway($fields, $t, $server)
{
	// get context app
	self::$restApp = AppTable::getByClientId($server->getClientId());
	// prepare method and call action
	$method = $server->getMethod();
	$method = mb_substr($method, mb_strpos($method, '.') + 1);// delete module-prefix
	$method = preg_replace('/./', '\', $method, substr_count($method, '.') - 1);
	$method = str_replace('.', '::', $method);
	$result = self::actionProcessing(
		$method,
		$fields,
		true
	);
	// prepare answer
	if ($result['type'] == 'error')
	{
		foreach ($result['result'] as $error)
		{
			throw new BitrixRestRestException(
				$error['error_description'],
				$error['error']
			);
		}
	}
	else
	{
		return $result['result'];
	}
}

Добавить комментарий