public function RestClient::httpRequestRaw in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequestRaw()
- 5.0.x src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequestRaw()
Return raw response content from given URL.
Useful for fetching data from binary fields like Attachments.
Parameters
string $url: The url to request.
Return value
mixed The raw http response body.
Throws
\Exception
Overrides RestClientInterface::httpRequestRaw
File
- src/
Rest/ RestClient.php, line 268
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
public function httpRequestRaw($url) {
if (!$this->authManager
->getToken()) {
throw new \Exception($this
->t('Missing OAuth Token'));
}
$headers = [
'Authorization' => 'OAuth ' . $this->authToken
->getAccessToken(),
'Content-type' => 'application/json',
];
$response = $this
->httpRequest($url, NULL, $headers);
return $response
->getBody()
->getContents();
}