1

I'm trying to create a new node using Drupal 7 + Services 3. The node type is 'activity_photo' has an image field, and a reference to a node. This is what I'm posting to the service

{
 "type":"activity_photo",
 "field_node_reference":{
 "und":[{
 "target_id":"x (1273)"
 }]
 },
 "field_photo":{
 "und":[{
 "fid":"20077"
 }]
 }
}

The response is status 200:

{"nid":null,"uri":...}

My error log shows the following:

Notice: Undefined index: display_field in file_field_widget_value()

Warning: end() [function.end]: Passed variable is not an array or object in file_managed_file_validate()

Notice: Undefined index: nid in _node_resource_create()

Any help on how to proceed?

1

In the end I changed the entity reference field to select list and posted like this:

{
 "title":"test",
 "type":"activity_photo",
 "language":"und",
 "field_node_reference":{
 "und":[1273]
 },
 "field_photo":{"und":[{"fid":"8880"}]}
}

also, I found my own modules was implementing hook_form_alter for this form, and this had further complications to be addressed to get it to work. So any hook_form_alter is something to remember when looking for similar problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.