0

I'm currently developing an Android App that uses REST to communicate with drupal

I've setup the Service module and got it working with normal "post" content type nodes

But, if i post a question node from the Answers module, it would not work. So, I post an JSON string like this:

{"node":
{
   "title":"REST question",
   "type":"question",
   "language":"und",
  "body":[
  {
     "und":{
        "value":"REST content",
        "format":"filtered_html"

     }
  }
]
}
}

Drupal would respond like this:

Request header:

Request Url: http://www.mubie.com/rest_api/node.xml
Request Method: POST
Status Code: 200 //<- the request is valid...
Params: {}

Respond body:

<?xml version="1.0" encoding="utf-8"?>
<result>
    <nid />
    <uri>http://www.myhost.com/?q=rest_api/node/</uri>
</result>

now, normally, if I post something like a blog post, it would return the node(nid) url, but with a question content type, it returns the url that lists all nodes. Also, the content is not added to drupal

How do i make it post my question content properly and return a node url?

0

I've figured it out, basically the answers module was changing the submit form's submit button text value. Doing this would break Service and make it not add any node to the database. The solution for me was to remove that modification made by answers module by commenting out some lines:

answers.module , line 163
// $form["actions"]["submit"]["#value"] = t("Post your answer");

And everything works fine after saving.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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