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

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.

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

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
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,271 views 2 13
Read article

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