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)

comment:{subject:"Subject of the comment, if not entered it will be auto-generated",
[{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.

5 Answers 5


The following JSON appears to be the minimum you need to post a comment:

  "subject":"Comment Subject Text",
      "value":"Comment body text"

Since there is no user, commenting on this "example.com/node/1" needs to be turned on and permissions for anonymous users to post comments need to be set.


Turns out I was trying to create nodes/comments without authentication, and the site didn't allow anonymous users to create nodes/comments. Once I turned on session auth, logged in properly, things worked fine.

  • 1
    So you turned on session auth in Drupal services or in your REST client? Can you give some quick tips on how you did this? Jun 18, 2012 at 14:58

Can you tell me to what URL you would post this json string. I've been looking all over the web for some documentation how to create a comment on a node using services 3. The documentation on this module is completely lacking. I've tried posting to:




Nothing seems to work. I always get "404 Not Found : Could not find controller"

EDIT: as soon as I posted this I got it to work. If it will help anyone else you post your json string to:


If you're using Poster to test be sure to set the content type to application/json. When using jquery make sure you set dataType: 'json'.


Here are some examples to create and update nodes and comments in the following format:

  • HTTP method
  • ContentType
  • URL Path
  • Data to Send

Node Create

  • POST
  • ContentType: application/json
  • ?q=endpoint/node.json


Node Update

  • PUT
  • ContentType: application/json
  • ?q=endpoint/node/123.json


Comment Create

  • POST
  • ContentType: application/json
  • ?q=endpoint/comment.json

    {"subject":"liJmJfpqMX", "comment_body":{"und":[{"value":"9DyaNZi3lA"}]}, "nid":"18"}

Comment Update

  • PUT
  • ContentType: application/x-www-form-urlencoded
  • ?q=endpoint/comment/456.json

    { cid: 456, "subject":"hzU27R6daE", "comment_body":{"und":[{"value":"BqZU5DwArD"}]}, "nid":"18"}

  • 1
    This works well. Should be the accepted answer! one thing to remember is to add the key:"Content-Type" value:"application/json" to your header if you are testing from Chrome postman. This is another invaluable resource: https://www.drupal.org/node/1447020 Apr 7, 2016 at 14:23

I was getting similar problems even when just testing with the firefox plugin poster. It turns out that it was quite simply the extra whitespaces and some other simple formatting (such as escapes) that was doing it. Here is a list of what works in my own tests for what I needed:

CREATE USER WORKS = endpoint/user

{"name":"myusername","pass":"12345678","mail":"[email protected]","status":"1"}

LOGIN WORKS = endpoint/user/login


CREATE FILE WORKS = endpoint/file


CREATE NODE WORKS = endpoint/node


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