I'm using Poster to test Services module.
I'm trying to update a node.
I put application/x-www-form-urlencoded, I set the parameter that I want to change and use the PUT method.
I always get "401 Unauthorized: Missing required argument node".
No problem with Create and Delete.
What's wrong?

Comments

upupax’s picture

Sorry, I forget to say, I'm using a REST Server.

kylebrowning’s picture

Can you verify this issue exists in 7.x-3.0-rc3?
Tests pass, and Im able to update when I use the Drupal iOS SDK as well.

What parameters are you adding? How are you adding them?

upupax’s picture

Ok, I found I was missing the authorization.
Any example for working with system.connect and session based authorization?
TIA

upupax’s picture

Sorry, it was not a problem of authentication, but of parameters.
In the node update example provided here https://gist.github.com/affc9864487bb1b9c918 the field to update is

node[field_test][0][value]=testtting

while my content needs (or Drupal 7 does?) the language parameter, so it's

node[field_test][it][0][value]=testtting

Now everything works fine.

upupax’s picture

Version: 7.x-3.0-rc2 » 7.x-3.0-rc3

Again, the problem persist for multiselect fields.
I tried to update them adding the language parameter, but I get this error:

Warning: Illegal offset type in isset or empty in _form_validate() (linea 1246 di /***/includes/form.inc).
An illegal choice has been detected. Please contact the site administrator.

cedwards.rei’s picture

Priority: Normal » Major

Having the exact same issue.

Notice: Array to string conversion in drupal_map_assoc()
Warning: Illegal offset type in isset or empty in _form_validate()
Error: Illegal choice Array in xxxx element.

In my case this happens with node references. Using the References module.

marcingy’s picture

Priority: Major » Normal

The issue is that you are building the correct structures excepted by fapi you need to submit a form from with drupal and add a dpm at the appropriate place in the code and ensure that the data structure you pass to services meets that critera.

cedwards.rei’s picture

Priority: Normal » Major

I managed to get it to work, so I'm not sure if I was doing it incorrectly or if there is a bug.

Before:

...
$node->field_top[$node->language][0]['value'] = 'hi there'; // OK
$node->field_foo[$node->language][0]['nid'] = 10; // Failed
$node->field_bar[$node->language][0]['nid'] = 23; // Failed
...

After:

...
$node->field_top[$node->language][0]['value'] = 'hi there'; // OK
$node->field_foo[$node->language][0] = 10; // OK
$node->field_bar[$node->language][0] = 23; // OK
...
marcingy’s picture

Priority: Major » Normal

See comment above

kylebrowning’s picture

Status: Active » Closed (works as designed)
roppa_uk’s picture

Issue summary: View changes

I'm getting the same, documentation is extremely poor. I simply need to add a field collection to a node using POST:

{
"field_name": "field_ingredients",
"field_quantity": "1",
"field_ingredient": "egg",
'host_entity': {
'uri': 'http://test/cms/node/47',
'id': '47',
'resource': 'node'
}
}

And I get:

<?xml version="1.0" encoding="utf-8"?>
Missing required argument node