You are here

protected function Salesforce::apiHttpRequest in Salesforce Suite 7.3

Private helper to issue an SF API request.

Parameters

string $path: Path to resource.

array $params: Parameters to provide.

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

string $type: Type of request. Examples include:

  • rest (default)
  • apexrest (custom REST written in APEX in Salesforce instance)

Return value

object The requested data.

1 call to Salesforce::apiHttpRequest()
Salesforce::apiCall in includes/salesforce.inc
Make a call to the Salesforce REST API.

File

includes/salesforce.inc, line 200
Objects, properties, and methods to communicate with the Salesforce REST API

Class

Salesforce
Ability to authorize and communicate with the Salesforce REST API.

Code

protected function apiHttpRequest($path, $params, $method, $type = 'rest') {
  $url = $this
    ->getApiEndPoint($type) . $path;
  $headers = array(
    'Authorization' => 'OAuth ' . $this
      ->getAccessToken(),
    'Content-type' => 'application/json',
  );
  $data = drupal_json_encode($params);
  return $this
    ->httpRequest($url, $data, $headers, $method);
}