You are here

protected function RestClient::httpRequest in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequest()
  2. 5.0.x src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::httpRequest()

Make the HTTP request. Wrapper around drupal_http_request().

Parameters

string $url: Path to make request from.

string $data: The request body.

array $headers: Request headers to send as name => value.

string $method: Method to initiate the call, such as GET or POST. Defaults to GET.

Return value

\GuzzleHttp\Psr7\Response Response object.

Throws

\GuzzleHttp\Exception\RequestException Request exception.

5 calls to RestClient::httpRequest()
RestClient::apiHttpRequest in src/Rest/RestClient.php
Private helper to issue an SF API request.
RestClient::getVersions in src/Rest/RestClient.php
Wrapper for "Versions" resource to list information about API releases.
RestClient::httpRequestRaw in src/Rest/RestClient.php
Return raw response content from given URL.
RestClient::initializeIdentity in src/Rest/RestClient.php
Retrieve and store the Salesforce identity given an ID url.
RestClient::refreshToken in src/Rest/RestClient.php
Refresh access token based on the refresh token.

File

src/Rest/RestClient.php, line 279

Class

RestClient
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

protected function httpRequest($url, $data = NULL, array $headers = [], $method = 'GET') {

  // Build the request, including path and headers. Internal use.
  $args = NestedArray::mergeDeep($this->httpClientOptions, [
    'headers' => $headers,
    'body' => $data,
  ]);
  return $this->httpClient
    ->{$method}($url, $args);
}