Hi guys
I'm new to drupal and want to start writing my own services.
It all works fine for stuff like node.load and other related services. Now I want to try and create some sort of node.save, but if I visit the node.save page in the Adminster / Services / node.save page, it asks me to enter the following node argument
Arguments (1)
struct node (required)
A node object. Upon creation, node object must include "type". Upon update, node object must include "nid" and "changed".
Does anyony know what the format is that I should use?
I tried several formats like this
- nid=1, type=story, title=Some title, body=some body
- [nid] =>1, [type]=>story, [title]=>Some title, [body]=>some body
- node([nid] =>1, [type]=>story, [title]=>Some title, [body]=>some body)
It does sound like a dumb question but can anyone give me the correct syntax? The only thing I get as a result of calling this service is the creation an empty node. Title and body fields don't seem to be taken into account. What's worse I can't even us this node cause when I try to edit it it fails, probably because the type is also blank
thx for any reply
Marc
Comments
Screencast
If you look through Drupal and the Desktop, you'll see I make a call to node.save. If you're making a new node, you have to pass a couple more values to allow it to process correctly.
Screencast
Thx Rob, great video tut btw
Rob, in your video...
Nice tutorial. At the end when you construct the node, this is what you have typed in your app:
XmlRpcStruct node = new XmlRpcStruct();
node["title"] = title;
node["body"] = body;
node["teaser"] = body;
node["format"] = 1;
node["type"] = story;
node["promote"] = true;
drupal.NodeSave (node);
If I were doing something in PHP, or Actionscript, how would it be different?
While the screencast is well thought out, the example video was for an application in C#, and most of the video is dealing with XMLRPC and C#, and only a portion of it about the Services Module and Drupal - in other words, if you're just starting out and trying to answer this question, and aren't doing a project in C#, the answer is in minute 17 of the 20 minute screencast and I'm not sure how valuable the rest of the video will be to you. If you want to figure out this module, I'm pretty sure your time will be better spent elsewhere. Where that is, I'm not so sure yet since the documentation is for people more advanced than I am. I'm new to services completely. There doesn't seem to be a place to start from zero.
If I were to be just inputting a node for the node.save section in the module, how would it read on one line and in the format of the node.save method form in the services admin interface? How is it best put into one line?
I've found this question unanswered in several places, including this group. Can someone answer in both concrete and abstract so as to be complete enough so that someone exploring the module for the first time would be able to figure it out and not stopped in his tracks in frustration - and still useful enough to be able to help someone who is trying to save a node from somewhere else for the first time.
Can someone give us an example? Is there a way to generalize from the example in the one line in the Drupal interface to writing an application in any language? How do we abstract from the C# example into something useful for other projects?
Don't get it...
Still don't get it:
What do I write in the node field on http://localhost/drupal/admin/build/services/browse/node.save ?
Samuel Lampa
RIL Partner AB
Here's the syntax for
Here's the syntax for node.load for node.save it would be:
<?php$nid = arg(1);
// Get an existing node object.
$node = node_load($nid);
$result = xmlrpc('http://example.com', 'node.save', $node);
?>
Ok, thanks. But I suppose
Ok, thanks. But I suppose this is how I should write in order to call the xmlrpc service with a PHP script (which is useful too) but what should I type into the node field on the service browser page for node.save (Under Administer > Site Building > Services > Browse > node.load) in order to save a (new) node?
( I like to try the simples possible case first )
Samuel Lampa
RIL Partner AB
Oh man...
I hear what you're asking and am trying to figure out that very thing!
Someone, please tell us the format to use when using the Services browser in the Drupal admin! See attached image.
See the patch on
See the patch on http://drupal.org/node/394654 - this still needs review (and possibly work) but should allow you to actually insert the node object for testing.