0

From this question, I know how to retrieve a list of forum posts (forum topics?) from drupal.

curl -i -X GET  \
 -H Cookie:SESSe6a353351df0bcafe98787beef=B0YAHD3-reWwwW-kzhqw6A-SgeShSYUAAQQjh \
 'http://myserver/rest/node?parameters\[type\]=forum'

Now, I'd like to limit the list of forum posts to those belonging to a particular forum. How do I filter the result by forum? I know the forum tid. I just don't know how to format the query.

This doesn't cut it:

curl -i -X GET  \
 -H Cookie:SESSe6a353351df0bcafe98787beef=B0YAHD3-reWwwW-kzhqw6A-SgeShSYUAAQQjh \
 'http://myserver/rest/node?parameters\[type\]=forum&tid=4'

The above returns all forum posts. This also does not work:

curl -i -X GET  \
 -H Cookie:SESSe6a353351df0bcafe98787beef=B0YAHD3-reWwwW-kzhqw6A-SgeShSYUAAQQjh \
 'http://myserver/rest/node?parameters\[type\]=forum&parameters\[tid\]=4'

It gives me:

"Invalid query provided, double check that the fields and parameters you defined are correct and exist. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tid' in 'where clause'"

I get the same error if I try to reference parameters\[taxonomy_forums\]

Any help?

1 Answer 1

0

To get all posts (forum topics) for a particular forum with id=4:

curl -i -X POST \
  -H Cookie:SESSe6a3baadbeef=ovQpO6aYeehaw_3W4onya22i9bonusQW \
  -H X-CSRF-Token:v6j7r9RactujA872hSHSKW-mYYWAA \
  -H Accept:application/json \
  -H Content-Type:application/json \
  http://myserver/rest/taxonomy_term/selectNodes \
  -d '{"tid":4}'

To find the mapping between forums and tids, refer to this answer.

I don't know how to do a parameterized query (GET) to retrieve forum topics. As far as I can tell you need to use POST, as described here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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