Forum Discussion
Are you just wanting the content from specific categories, because there's also a community level call for that method:
http://community.lithium.com/community-name/restapi/vc/unanswered
If you only want data from specific categories, another option to consider instead of trying to combine multiple calls, you could make the community level call and then only use the results from categories that you're interested in.
If you're only using the data externally (instead of in a custom component), an endpoint would be useful, as Nathan suggested. Here's an example of how to condense REST API calls in an endpoint:
- dhiraj_gophane12 years agoLeader
Hi Nathan and Adam,
Thanks for your follow up, I really appreciate it.
Adam as you said I dont want to make multiple calls. So I'm not using endpoint.
Here is my code, I want one call to be done to fetch the messages from multiple categories.
Can you please suggest the solution?Also let me knoe if we need to ask for any configuration from lithium side to get the results.
code:
<#assign user_has_role = false />
<#list restadmin("/users/id/${user.id?c}/roles").roles.role as role>
<#if role.name?? && ((role.name == "Staff")) || ((role.name == "Administrator"))|| ((role.name =="BlogAuthor"))||((role.name == "BlogModerator"))>
<#assign user_has_role = true />
</#if>
</#list>
<#if user_has_role >
<#assign results_list_size = 5 />
<#assign rest_query = "/unanswered?sort_by=-topicPostDate&page_size=" + results_list_size />
<div id = "threads-without-reply" class="lia-panel lia-panel-standard top-five-threads-with-no-replies-wrapper">
<#assign categoryId = coreNode.id>
<#if coreNode.nodeType != "category">
<#if coreNode.ancestors?size gt 0>
<#assign categoryId = coreNode.ancestors[0].id>
</#if>
</#if>
<#if categoryId == "Employees" || categoryId == "USHRBenefits">
<#assign message_list_title = "Customer Threads without Replies" />
<#else><#assign message_list_title = "Threads without Replies" />
</#if>
<@component id="forums.widget.message-list-panel" title="${message_list_title}"
messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size /></div>
</#if>- dhiraj_gophane12 years agoLeaderCan we exclude any category while making the call?
Related Content
- 4 years ago
- 3 years ago
- 2 years ago