I have patched my local services module copy to support passing the vid of a node into _node_resource_retrieve() as an argument.

diff --git a/sites/all/modules/custom/services/resources/node_resource.inc b/sites/all/modules/custom/services/resources/node_resource.inc
index 7cc3e0e..6a86926 100644
--- a/sites/all/modules/custom/services/resources/node_resource.inc
+++ b/sites/all/modules/custom/services/resources/node_resource.inc
@@ -14,6 +14,13 @@ function _node_resource_definition() {
             'type' => 'int',
             'description' => 'The nid of the node to get',
           ),
+          array(
+            'name' => 'vid',
+            'optional' => TRUE,
+			'source' => array('param' => 'vid'),
+            'type' => 'int',
+            'description' => 'The vid of the node to get',
+          ),
         ),
         'access callback' => '_node_resource_access',
         'access arguments' => array('view'),
@@ -198,8 +205,8 @@ function _node_resource_definition() {
  *
  * @see node_load()
  */
-function _node_resource_retrieve($nid) {
-  $node = node_load($nid);
+function _node_resource_retrieve($nid, $vid) {
+  $node = node_load($nid, $vid);
 
   if ($node) {
     $uri = entity_uri('node', $node);

This allows clients consuming the services to access all revisions of a node. Can we get this change into the drupal.org services code?

Thanks,
-Ian Page Hands

Comments

marcingy’s picture

Status: Needs review » Needs work

This has wider implications as viewing revisions of a node requires permissions beyond just a simpel view so this needs more work before it can even consider being committed to services.

iphands’s picture

This has wider implications as viewing revisions of a node requires permissions beyond just a simpel view so this needs more work before it can even consider being committed to services.

Ahh... I had assumed the node_load() would fail if the user did not have permission to view the particular revision. My understanding of Services and permissions (or Drupal permissions for that matter) is not very good.

To your knowledge, is there an example implementation of more advanced permissions on node access in Services that I should take a look at?

ygerasimov’s picture

@iphands, I would suggest to use node module menu access callback _node_revision_access($node, $op).

kylebrowning’s picture

Status: Needs work » Closed (won't fix)

at any rate, you can use index to pull this information.

cotto’s picture

For future reference, the best way to do this with 3.x Services is:
GET http://yoursite/api/node.json?parameters[vid]=1