Claudius
13 years agoBoss
REST: Get current node's category
I'm trying to get hold of the current node's top category via REST API, but would even be happy with just the parent category. I would love to do something as simple as http://community.lithium.co...
- 13 years ago
Hi Claudius,
There are a couple possible approaches...
To get the category for a a message, you can do something like:
http://lithosphere.lithium.com/restapi/vc/messages/id/42810/board/category
This works because "/messages/id/42810" returns a Message object. Since this gives you a Message object, you can call the "board" method by simply appending "/board". This returns a Board object, on which you can call the "category" method by appending "/category".
If you want to go the freemarker route insted, you're on the right track. The problem you're running into is that coreNode.ancestors actually gives you a sequence of objects (nodes), so you can't output it directly. Check out this post I created awhile back on working with coreNode.ancestors:
I hope this helps!
-Adam