Simple REST request to create nodes I'm having the following issue trying to create nodes from Drupal 7 to a Drupal 6 install. The target Drupal site is running Services 3.x.

Here's my code: 

$base_url = $params['path'];
$data = array(
  'username' =&gt; $params['username'],
  'password' =&gt; $params['password'],
);
$data = http_build_query($data, '', '&amp;');
$headers = array();
$options = array(
  'headers' =&gt; array('Accept' =&gt; 'application/json'),
  'method' =&gt; 'POST',
  'data' =&gt; $data
);

$response = drupal_http_request($params['path'] . '/user/login', $options);
$data = json_decode($response-&gt;data);

// Check if login was successful
if ($response-&gt;code == 200) {
  // Now recycle the login cookie we recieved in the first request
  $options['headers']['Cookie'] = $data-&gt;session_name . '=' . $data-&gt;sessid;

  // Create a new node
  $data = array(
    'node' =&gt; array (
      'type' =&gt; 'cloudnode',
      'title' =&gt; 'node1',
      'field_ip_address' =&gt; array ('value' =&gt; '1.2.3.4'),
    )
  );
  $options['data'] = http_build_query( $data, '', '&amp;');
  $options['method'] = 'POST';
  $response = drupal_http_request($base_url . '/node', $options);
} 
else {
  die ('Failed to login');
}


I get a 200 response; the node is being created, but somehow it doesn't take care of my 'field_ip_address' CCK field at all.

I've tried any kind of variations but they don't work. There is not much documentation around as well.

If anyone has succeeded in creating nodes using REST, I would be very interested for any help.
CCK fields are always stored as an array of fields, even if the actual field is limited to only a single value.

So you it should be something like:

'field_ip_address' =&gt; array(array('value' =&gt; '1.2.3.4'))

Note that in Drupal 7, field values are additionally grouped by the language, which is 'und' (LANGUAGE_NONE) if the field is language-agnostic. So it would be something like this:

'field_ip_address' =&gt; array('und' =&gt; array(array('value' =&gt; '1.2.3.4')))

Copied from my comment, so that the question can be marked as fixed :)