Forum Discussion

qinglau's avatar
qinglau
Mentor
11 years ago
Solved

Count total blog articles in one specific category level

Hi All, 

 

i am currently working on a custom component which can count all the blog articles in one specific category level. I can not find any related REST API to do that. 

 

What I have workaround solution is to use two REST API call to acheive that. 

 

 

1. First rest API call is used the category ID to get all the blogs ID under this category. 

<#list rest("/categories/id/${rootCategory}/blogs?restapi.response_style=view").blogs.blog as blog>

 

 

2. Second rest API call is used the blog.id from first call and then make a call to get message count 

 

rest("/blogs/id/${blog.id}/messages/count").value?number />

 and then sum up the total number of articles .

 

Does anyone know a better way to do that? 

 

thank you. 

 

Cheers,
Qing 

 

3 Replies