I set up the Services module as REST server, so I can create nodes with custom fields by REST client as in Services 3 - POST node.create with custom fields.
The settings of the Services module are the following.
Server => REST
Path to endpoint => "neoapi"
Session authentication => yes
Response formatters => json
Request parsing => application/json & application/x-www-form-urlencoded
Resource path => http://127.0.0.1/neoapi/node
Content type => mycontent
Term reference field => Autocomplete term widget (tagging)
And post next JSON data via Google Chrome Advanced Rest Client
{
"type":"mycontent",
"title":"The New Article",
"body":{
"und":[ {
"value":"This is the body of new article."
} ] },
"field_neo_terms":{
"und":[ {
"tid":"3"
} ] }
}
At REST client I receive "200. OK" NID and URI of new node. But in site i have new node with title and body, but without terms and error:
Warning: mb_strlen() expects parameter 1 to be string, array given in drupal_strlen()
(line 441 of C:\Program Files\VertrigoServ\www\includes\unicode.inc).
Warning: preg_match_all() expects parameter 2 to be string, array in drupal_explode_tags()
(line 7254 of C:\Program Files\VertrigoServ\www\includes\common.inc).
Warning: array_unique() expects parameter 1 to be array, null given in drupal_explode_tags()
(line 7255 of C:\Program Files\VertrigoServ\www\includes\common.inc).
Warning: Invalid argument supplied for foreach() in drupal_explode_tags()
(line 7258 of C:\Program Files\VertrigoServ\www\includes\common.inc).