2

I'm using Drupal 7 + Services 3 to create nodes with POST and JSON. Everything works fine, except field types of select - entity reference select or plain text.

The entity reference uses the autocomplete widget, while the text select is a plain radio button.

This is the format I'm using:

"field_urgency": {
    "und": [  {  "value": 1    }   ]
}

2 Answers 2

1

Eventually I figured this out:

    {
    "title": "some more tests",
    "type": "weed",
    "field_sprouts": {
        "und": [ 8,9 ]
    },
    "field_urgency": {
        "en": [
            {
                "value": "2"
            }
        ]
    },
    "field_species": {
        "und": [ 4 ]
    }
 }

species and sprouts are entity references and only need the nid of the target (no value= or target_id= or anything). For unknown reason (as of yet), the urgency field required a language to be defined (other then und[efined]). Its the only select field here with a normal select list, not entity refernce. Make sure your widgets are select list and not auto complete.

-1

The PUT format for boolean or select list :

{
  "field_order_status":{
    "und":["1"]
  }
}

it would be ok.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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