4

I have added a REST web service in Drupal and all content is tagged with taxonomy. I'm now trying to acquire all related nodes to the terms.

First I'm calling taxonomy_vocabulary/getTree along with the vid and I'll get all the terms for a specific vocabulary, that works just fine. The problem comes when I've gotten all the term-id's I need to go through. When I create a request it fails to find the nodes that should be connected to the term. I'll get a 404 response on each request.

This is how I call the selectNodes. I'm creating a POST request and pass along with the tid, the endpoint is called http://myhostname/api/taxonomy_term/selectNodes

Have someone else experienced this? Do I need to pass more arguments with the POST call?

EDIT: After a quick look in wireshark it also returns the error string: "String value: No nodes were found with tid 15". Does this mean that there aren't any relation between the terms and the nodes by default?

1 Answer 1

0

The taxonomy_term resource is only for returning taxonomy terms. It won't return any nodes.

There are tons of options but here are two that you can do quickly:

  1. Install the Views Datasource module and create a taxonomy view. Have it output as json.

  2. Create a custom resource that handles this. Check out these instructions on creating a custom resource.

Your Answer

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

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