You are here

public function Client::post in Little helpers 7

Same name and namespace in other branches
  1. 7.2 src/Rest/Client.php \Drupal\little_helpers\Rest\Client::post()

Send a POST request to the API.

Parameters

string $path: The path to call.

array $query: An array of query parameters.

mixed $data: JSON encodeable data.

array $options: Options for @see drupal_http_request().

Return value

array The decoded data from the response.

File

src/Rest/Client.php, line 59

Class

Client
This a simple JSON REST Client based on drupal_http_request().

Namespace

Drupal\little_helpers\Rest

Code

public function post($path, array $query = [], $data = NULL, array $options = []) {
  $options['method'] = 'POST';
  return $this
    ->send($path, $query, $data, $options);
}