Posted by timosea on September 23, 2008 at 3:24pm
Hi there, I'm still having fun with services, as2 and node.save, I moved on from initial experiment with swx to using the xmlrpc service, which initially seemed really easy due to some great posts including this one by d0ublej0's http://drupal.org/node/82114#comment-263405 . Everything is working nicely until I try and add content to a CCK field, i think this post http://drupal.org/node/256074 describes correct structure, but i'm unsure on how to create this structure using the mattism as2 xmlrpc classes. Can anyone nudge me in the right direct, I'm using as2, drupal 5.7, cck-5.x-1.7 and services-5.x-0.92?
import com.mattism.http.xmlrpc.Connection;
import com.mattism.http.xmlrpc.ConnectionImpl;
function createNode ( sTitle , sBody ) {
var co:Connection = new ConnectionImpl();
co.setUrl(url);
co.onLoad = onCreateNode;
//var node:Object = {type:"mytype",status:"1",title:sTitle ,body:sBody, name:userName};
//co.addParam( api_key, "string" );
var node = new Object()
node.type="mytype"
node.status="1"
node.title=sTitle
node.body=sBody
node.name=userName
//node.field_filelocation = new Array({value:"http://www.myfilelocation.com/id1.swf"})
node.field_filelocation ="<value><array><data><value><member><name>value</name><value><string>somewhere.jpg</string></value></member></value></data></array></value>"
co.addParam(sessid, "string" );
co.addParam(node,XMLRPCDataTypes.STRUCT);
co.call('node.save');
updateStatus("creating node...");
}the related method call for node.field_filelocation is
<member><name>field_filelocation</name><value><value><array><data><value><member><name>value</name><value><string>somewhere.jpg</string></value></member></value></data></array></value></value></member>