I'd like to be able to create a topic on an existing forum, using the REST API exposed by the Services module. This is drupal7 and services 3.x .
via the REST interface, I can successfully:
- query the index of forums
GET /rest/node?parameters\[type\]=forum
- retrieve a single forum post.
GET /rest/node/8
- update forum posts (via PUT)
PUT /rest/node/8 ...
I have not been able to create a forum post. I tried many different variations of the JSON payload, and have not yet found the secret to success.
Example:
curl -i -X POST \
-H Cookie:SESSe6a353351df0bfa8deadcafe=B0ZkiW3-U2x93yJU-deadbeef \
-H X-CSRF-Token:PSCd5qIdddax0Mh5gfnOM872hdj893-eeeeffff \
-H Accept:application/json \
-H content-type:application/json \
http://myserver/rest/node \
-d '{
"title": "This is a test post",
"body": {
"und": [{
"value" : "This is a test post. Please ignore.",
"summary": "test1",
"format": "filtered_html"
}]
},
"type": "forum",
"language": "und",
"status": "1",
"forum_tid": "8"
}'
The error looks like this
{
"form_errors": {
"taxonomy_forums][und":"An illegal choice has been detected. Please contact the site administrator."
}
}
I have tried many variations of the payload, and always get the same error. I think the error means I need to pass different data. But I don't know which different data. Help?