comment count by space

Dear all, 

Would it be possible to count comment by space list, such as the address : https://drive.google.com/file/d/0BxriXuT0xeaFLWlUM2J5MzQwZjQ/view?usp=sharing

Thank you.

1 answer

0 votes
Stephen Deutsch Community Champion Oct 10, 2015

There's probably a way using the database, but I know the API better, so here's a method using that.  Just paste the following code in your browser console and you'll get a comma separated list smile

jQuery.ajax({
    contentType: "application/json",
    type: "POST",
    url: contextPath + "/rpc/json-rpc/confluenceservice-v1/getSpaces",
    success: function( response ) {
        jQuery(response).each(function() {
            var space = this;
            jQuery.ajax({
                url: contextPath + "/rest/searchv3/1.0/search?type=comment&where=" + space.key,
                success: function(results) {
                    console.log(results.total + ", " + space.name + ", " + space.key);
                }
            });
        });
    }
});

But I tried add these code as listed as above by html macro, it does not show anything. How can we separate the list by month /week? Thank you.

Stephen Deutsch Community Champion Oct 11, 2015

It doesn't run in the HTML macro, you have to copy/paste it into the browser console (usually pulled up by pressing F12). As for listing by month/week, what did you have in mind? all months/weeks in 2015? you have to run a separate query for each space and for each week/month, so let me know.

Dear Stephen , 

Thank you for your kindly assistance.

Just make sure how can we execute the code as listed as above , because we have pasted the code into google chrome browser and then how can we run it ? Thank you.

comment.jpg

Stephen Deutsch Community Champion May 22, 2016

You should just be able to press Enter and it should run smile

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

72 views 3 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you