Search code examples
drupal-7

Drupal Services Plugin ignoring multi-value fields


I'm using drupal 7 with services plugin 3.17 I'm trying to create a node with a field that accepts multiple values via json api with the following data:

{
    "type":"custom_type_article",
    "title":"My title",
    "language":"und", 
    "body": { 
        "und": [ { "value": "Article body" } ]  
    },
    "field_article_auhtors": {
        "und": [{"value": "author 1"}, {"value": "author 2"}, {"value": "author 3"}]
    }
}

The node is succesfully created but only the first value of field_article_auhtors is populated.

Is my json structure incorrect to create multiple values on "field_article_auhtors"?


Solution

  • Version 3.17 of Services has a bug with multi value fields. It looks like the bug is a regression introduced around version v3.6.

    A patch was released in November, and multiple users are reporting it as working, though officially it's marked as 'Needs Work'. (The author has asked for a review of the code, and it has already been included in the dev version of Services. That said, a gentle nudge / reminder to test it in a dev environment. ;)

    See the conversation, the patch, and a dev release of Services that includes it over on Drupal's official Services Project section at https://www.drupal.org/project/services/issues/2224803