You are here

function restclient_post in RESTClient 7.2

Make a POST request

Parameters

string resource_path: The path to the REST method.

You can include wildcards in the string which will be filled in by the $parameters array. Ex: /Courses/%session

array $variables: An array of variables with the following keys:

endpoint [optional] : URL or hostname to the REST root. Specify a value to override the default configuration

parameters [optional] : Key/value pairs of parameters to inject into the resource path Ex: array('%session' => 20111)

headers [optional] : Key/value pairs of extra header data to include in the request

data [optional] : Key/value pairs of data to include in the request body of the request

body [optional] : Raw body data to include in the post body. This will be sent as is.

multipart [optional] : Whether to treat your data as a multipart request If TRUE, your data should be formatted as follows 'data' => array('fid' => $fid, 'some text', 'some more text')

The $fid value is a Drupal file id. A key of 'file' is required to denote file data so the API can treat it as a file accordingly.

retry [optional] : Number of retries. Defaults to 3

timeout [optional] : Timeout in seconds. Defaults to 30

reset [optional] : Boolean flag to reset the cache. Defaults to FALSE.

authentication [optional] : Array ...

  • oauth2_client: Authenticate using OAuth. Contains an array of values to pass through so oauth2_client creates the client. May contain just ['name'] to look up an existing client by name. See oauth2_client documentation.
  • oauth_format [optional]: The format for the Authorization request header to accommodate different server implementations. The default format is 'Bearer :token' where :token is replaced with the OAuth token.

Return value

object Returns an object containing the response data, FALSE otherwise.

See also

http://en.wikipedia.org/wiki/POST_%28HTTP%29

http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ht...

1 call to restclient_post()
restclient.wsconnector.inc in ./restclient.wsconnector.inc

File

./restclient.module, line 197
Defines a standard REST interface to RESTful services

Code

function restclient_post($resource_path, $variables = array()) {
  return _restclient_request_with_body($resource_path, $variables, 'POST');
}