Hello, i need to update multiple nodes using Services using Oauth. These nodes are chosen by nid. So i am using the PUT method, accessing:
{endpoint}/node/248?consumer_key....
what i want to have is:
{endpoint}/node/248?242?234?consumer_key...
The data that I modify is inside the json. I am using the standard Update method of the module:
'update' => array(
'help' => 'Update a node',
'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/node_resource'),
'callback' => '_node_resource_update',
'args' => array(
array(
'name' => 'nid',
'optional' => FALSE,
'source' => array('path' => 0),
'type' => 'int',
'description' => 'The nid of the node to update',
),
array(
'name' => 'node',
'optional' => FALSE,
'source' => 'data',
'description' => 'The node data to update',
'type' => 'array',
),
),
'access callback' => '_node_resource_access',
'access arguments' => array('update'),
'access arguments append' => TRUE,
),
Also i am using the default _node_resource_access, because i want that my Update would be portable, just an extension of the single node version.
What i need to do?
Comments
Comment #2
joachim commentedYou'd need to completely rewrite the controller, as the assumption that one request is one entity is baked pretty deep into the module!
Comment #3
Giuliano82 commentedOk, i just need to write ONE operation for my update. What i need to do? I hope i don't need to create from scratch a custom module just to get a Json and update 1 field of the nodes specified.
Comment #4
Giuliano82 commentedI solved my problem creating a custom module to add my custom Resource(including my operation to update the nodes, i send a json with nids and field i need to update). I didn't know services module could be extended adding custom resources without replacing the original services module operations.
Comment #5
joachim commentedCool! Glad you figured something out.
(And yes, extensibility and pluggability is very much the Drupal way!)
Comment #7
Siriki commentedDear Giuliano82,
Please provide the sample module, because i struggled same thing here.
Thanks for advance..!