public function ServicesClientConnection::index in Services Client 7
Same name and namespace in other branches
- 7.2 services_client_connection/include/connection.inc \ServicesClientConnection::index()
List resources from remote endpoint.
Parameters
$resource: Resource type i.e. 'user' or 'node'
$fields: List of fields that should be retrieved for resource. Can be either string of comma separted values like 'nid,title,uid,created' or array which will be automatically converted to list. Default is all fields '*'.
$parameters: Filter resources by params.
$page: Page number - default 0
Return value
List of remote resources
File
- services_client_connection/
include/ connection.inc, line 306 - Main services client connection class which exposes simple API
Class
- ServicesClientConnection
- @file Main services client connection class which exposes simple API
Code
public function index($resource, $fields = '*', $parameters = array(), $page = 0) {
$data = array();
if (!empty($parameters)) {
$data['parameters'] = $parameters;
}
if (is_array($fields)) {
$fields = implode(',', $fields);
}
$data['fields'] = $fields;
if (!empty($page)) {
$data['page'] = $page;
}
$this->http_request = $this
->createRequest(array(
'resource' => $resource,
'http_method' => 'GET',
'data' => $data,
));
return $this
->processRequest()->data;
}