You are here

function node_service_view in Services 7

Same name and namespace in other branches
  1. 5 services/node_service/node_service.module \node_service_view()
  2. 6.2 services/node_service/node_service.inc \node_service_view()

Returns a specified node.

Parameters

$nid: Number. The node ID.

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

$teaser: Boolean (optional). Format as teaser.

$page: Boolean (optional). Format as page.

Return value

Object. The node object with all wanted fields.

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

File

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

Code

function node_service_view($nid, $fields = array(), $teaser = FALSE, $page = FALSE) {
  $node = services_node_load(node_build_content(node_load($nid), $teaser, $page), $fields);
  if (!$node) {
    return services_error(t("Could not find the node."), 404);
  }
  return $node;
}