You are here

function node_service_get in Services 6

Same name and namespace in other branches
  1. 6.2 services/node_service/node_service.inc \node_service_get()
  2. 7 services/node_service/node_service.inc \node_service_get()

Returns a specified node.

Parameters

$nid: Number. The node ID.

$fields: Array (optinonal). The node fields needed. If its empty, all fields will be returned

Return value

Object. The node object with all wanted fields.

1 string reference to 'node_service_get'
node_service_service in services/node_service/node_service.module
Implementation of hook_service().

File

services/node_service/node_service.inc, line 19
@author Services Dev Team

Code

function node_service_get($nid, $fields = array()) {
  if (!($node = services_node_load(node_load(array(
    'nid' => $nid,
  )), $fields))) {
    return services_error(t('Could not find the node.'));
  }
  return $node;
}