You are here

public function DeployServicesClient::entityRequest in Deploy Services Client 7

Performs a request to the endpoint to perform an action on an entity.

Parameters

EntityMetadataWrapper $entity: The entity object to be used in the request. Construct this by calling entity_metadata_wrapper() on a normal Drupal entity.

$method: The HTTP method (e.g., 'GET' or 'DELETE') for the request.

$data: (Optional) A string containing the data to send (e.g., for a 'PUT' request). If not provided, no data will be sent.

Return value

The drupal_http_request() response object returned from the request.

Throws

DeployServiceException

See also

drupal_http_request()

3 calls to DeployServicesClient::entityRequest()
DeployServicesClient::delete in ./deploy_services_client.client.inc
Performs a DELETE request to delete an entity on the endpoint.
DeployServicesClient::get in ./deploy_services_client.client.inc
Performs a GET request to retrieve data about an entity from the endpoint.
DeployServicesClient::unpublish in ./deploy_services_client.client.inc
Performs a request to unpublish an entity on the endpoint.

File

./deploy_services_client.client.inc, line 262
Defines a Services client class which communicates with Deployment endpoints.

Class

DeployServicesClient
Class which defines a Services client based on a Deployment endpoint.

Code

public function entityRequest(EntityMetadataWrapper $entity, $method, $data = NULL) {
  $path = $entity
    ->type() . '/' . $entity->uuid
    ->value() . '.json';
  return $this
    ->request($path, $method, $data);
}