You are here

function clients_connection_drupal_services_rest_7::callMethodArray in Web Service Clients 7.3

API function to request a remote resource.

(This function has a rubbish name and parameters for historical reasons: XMLRPC connection classes were developed first.)

Parameters

$method: The path of the remote resource to retrieve.

$method_params: A flat array of further parameters for the request. This should contain:

  • The HTTP method.
  • (optional) An array of data for the request, such as POST data.

Return value

Whatever is returned from the remote site.

Overrides clients_connection_base::callMethodArray

File

connections/clients_drupal_rest/clients_drupal_rest.inc, line 173
Contains classes for Client connections handlers.

Class

clients_connection_drupal_services_rest_7
Class for Drupal client connections, REST D7.

Code

function callMethodArray($method, $method_params = array()) {
  $resource_path = $method;
  $http_method = array_shift($method_params);

  // The data array doesn't have to be present, so we have to fiddle about
  // to make sure we don't pass a NULL for it to makeRequest().
  if (count($method_params)) {
    $data = array_shift($method_params);
  }
  else {
    $data = array();
  }
  return $this
    ->makeRequest($resource_path, $http_method, $data);
}