function _node_resource_index in Services 7.3
Same name and namespace in other branches
- 6.3 resources/node_resource.inc \_node_resource_index()
- 6.2 services/node_service/node_resource.inc \_node_resource_index()
- 7 services/node_service/node_resource.inc \_node_resource_index()
Return an array of optionally paged nids based on a set of criteria.
An example request might look like
http://domain/endpoint/node?fields=nid,vid¶meters[nid]=7¶meters[...
This would return an array of objects with only nid and vid defined, where nid = 7 and uid = 1.
@todo Evaluate the functionality here in general. Particularly around
- Do we need fields at all? Should this just return full nodes?
- Is there an easier syntax we can define which can make the urls for index requests more straightforward?
Parameters
$page: Page number of results to return (in pages of 20).
$fields: The fields you want returned.
$parameters: An array containing fields and values used to build a sql WHERE clause indicating items to retrieve.
$page_size: Integer number of items to be returned.
$options: Additional query options.
Return value
An array of node objects.
3 string references to '_node_resource_index'
- hook_services_resources in docs/
services.services.api.php - Defines function signatures for resources available to services.
- ServicesRESTServerTests::getTestResource in servers/
rest_server/ tests/ ServicesRESTServerTests.test - _node_resource_definition in resources/
node_resource.inc
File
- resources/
node_resource.inc, line 495
Code
function _node_resource_index($page, $fields, $parameters, $page_size, $options = array()) {
$node_select = db_select('node', 't')
->addTag('node_access');
services_resource_build_index_query($node_select, $page, $fields, $parameters, $page_size, 'node', $options);
if (!user_access('administer nodes')) {
$node_select
->condition('status', 1);
}
$results = services_resource_execute_index_query($node_select);
return services_resource_build_index_list($results, 'node', 'nid');
}