- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/lib/oauth/client.php
- Класс: BitrixRestOAuthClient
- Вызов: Client::call
public function call($methodName, $additionalParams = null, $licenseCheck = false)
{
if ($this->clientId && $this->clientSecret)
{
$additionalParams = $this->prepareRequest($additionalParams, $licenseCheck);
$httpClient = $this->getHttpClient();
$httpResult = $httpClient->post(
$this->getRequestUrl($methodName),
$additionalParams
);
$response = $this->prepareResponse($httpResult);
if ($response)
{
if (!$licenseCheck && is_array($response) && isset($response['error']) && $response['error'] === 'verification_needed')
{
return $this->call($methodName, $additionalParams, true);
}
}
else
{
addMessage2Log(
'Strange answer from Bitrix Service! '
. static::SERVICE_URL
. static::SERVICE_PATH
. $methodName . ": "
. $httpClient->getStatus() . ' '
. implode(" ", $httpClient->getError())
. $httpResult
);
}
return $response;
}
else
{
throw new SystemException("No client credentials");
}
}