protected function RestClient::apiHttpRequest in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::apiHttpRequest()
- 5.0.x src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::apiHttpRequest()
Private helper to issue an SF API request.
Parameters
string $url: Fully-qualified URL to resource.
array $params: Parameters to provide.
string $method: Method to initiate the call, such as GET or POST. Defaults to GET.
Return value
\GuzzleHttp\Psr7\Response Response object.
Throws
\Exception
\GuzzleHttp\Exception\RequestException
1 call to RestClient::apiHttpRequest()
- RestClient::apiCall in src/
Rest/ RestClient.php - Make a call to the Salesforce REST API.
File
- src/
Rest/ RestClient.php, line 249
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
protected function apiHttpRequest($url, array $params, $method) {
if (!$this->authToken) {
throw new \Exception($this
->t('Missing OAuth Token'));
}
$headers = [
'Authorization' => 'OAuth ' . $this->authToken
->getAccessToken(),
'Content-type' => 'application/json',
];
$data = NULL;
if (!empty($params)) {
$data = $this->json
->encode($params);
}
return $this
->httpRequest($url, $data, $headers, $method);
}