I'm having trouble getting services to recognize a POST to /comment.json. I have a similar issue with creating nodes as well.
The following is the error I get: HTTP/1.1 406 Not Acceptable: Missing required argument comment
This message comes from the file: /services/server/rest_server/includes/RESTServer.inc Specifically, the lines:
elseif (!isset($info['optional']) || !$info['optional']) {
return services_error(t('Missing required argument !arg', array(
'!arg' => $info['name'],
)), 406);
}
basically, it seems to think the "comment" argument is missing (and it's not optional).
This is one of many bits of JSON I've given it (posting a comment to node 8801)
{name:"test",language:"und",cid:"0",pid:"0",uid:"17593",nid:"8801",
comment:{subject:"Subject of the comment, if not entered it will be auto-generated",
comment_body:
{und:[
[{value:"value of the field comment in the comment, remember that in D7 we can create fields for comments too", format: "full_html"}]
]}}}
It's perfectly valid (based on other online JSON checks). It also matches what I see in the services test examples at /services/test/functional/ServivesResourceCommentTests.test
however, I always get the same error message. This seems similar to: Drupal 7 services json node object
which is also unresolved. Can someone help me with the proper JSON formatting? Really, all I want to do is pass it something like:
{ nid : 8081 , uid : 17593 ,comment:{comment_body:"test",subject:"test"}}
my http headers seem ok and user/login worked fine.