0
votes

Using Drupal 6 with Services 2.2, I can create nodes with title and body populated fine. I can also upload an image. But I can't populate the imageField CCK field. Also, I have a custom node_reference field that I cannot populate.

Any ideas or example services? Thanks

1

1 Answers

0
votes

I don't have any code offhand, but what you want to do is populate the CCK field like this:

$node->field_your_cck_photo[0]['array_fields'] = value;

Note that if you have multiple photos, you will need to loop and include the index in place of 0. At the end, when you node_save, Drupal will do the rest of the work. If all goes well, it will populate the cck field with the photo you are referencing.

Create a node with a photo, then dump the node object and it will show you the structure. I have done this for a handful of sites with SOAP services.

CCK fields are typically done in this structure when building a node object:

$node->field_cckfield_name[delta]['property']