Forum Discussion
skylinegtr in future post, please list what you've been trying ;)
Now, based on this tutorial, and the category resource, I assume this code would work:
<h2>JOIN THE DISCUSSION</h2> <#--Use the rest FreeMarker context object, passing the rest_version parameter and LiQL query (encoded by appending ?url) --> <#assign categories = rest("2.0","/search?q=" + "SELECT id, title, topics.count(*), messages.count(*), views, view_href FROM categories ORDER BY topics.count(*) ASC"?url) /> <ul> <#list categories.data.items as category > <li><a href=“${category.view_href}”>${category.title}</a><br /> Topics count: ${category.topics.count} <br /> Messages count: ${category.messages.count} <br /> </li> </#list> </ul>
Disclaimer: I won't be responsible for any side effects of my code. Please test, test, and test on your stage environment first before pushing to production ...
- skylinegtr10 years agoMentor
OlivierS – Thanks for your help with this. Sorry, I should have been clearer.
What I’m trying to do is to display 3 subject/topics for each category in the custom components.
For example:
The Blog has Topic/Subject- Bartz Blog, Ben’s Suport, Support News, Process
Knowledge & Support has Topic/Subject-Customer Knowledge Base, Customer Product Ideas, Partner Knowledge Base.
It’s my first time dealing with API’s.
- skylinegtr10 years agoMentor
The code below lists categories and the boards within them.
<#assign category = rest("2.0","/search?q=" + "SELECT id, title, boards FROM categories"?url).data.items![] />
<#list category as category>
<h2>${category.title}</a></h2>
<#assign board = rest("2.0","/search?q=" + category.boards.query?url).data.items![] />
<ul>
<#if board?size gt 0>
<#list board as board>
<li><a href="${board.view_href}">${board.title}</a></li>
</#list>
<#else>
<li>No boards in this category</li>
</#if>
</#list>It shows the following:
Knowledge & Support
-Customer Knowledge Base
- -Customer Product Ideas
-Partner Knowledge Base
-Internal Knowledge Base
-TSE Notes
Forums
-Customer Product Discussion
-Customer Tools, Tips & Tricks
-Customer General Discussion
-Partner Forum
-Employee Product Discussion
-Employee Social Discussion
-TSE Discussion
-SQL Experts Forum
Idea Exchange
Internal Idea Exchange
@SupportOps
Blogs
-Ben's Support Sermon
-Support News, Process, and Announcements
-Bartz Blog
If I only want the categories for the Forums or Knowledge and Support? How can I accomplish this?
- OlivierS10 years agoLithium Alumni (Retired)
skylinegtr you can filter by id:
SELECT id, title, boards FROM categories WHERE id IN('forums','kb')
- skylinegtr10 years agoMentor
OlivierS Thank you!
- -Customer Product Ideas
Related Content
- 2 years ago
- 10 years ago
- 4 years ago