comment count by space

Hsu Yao Chang October 9, 2015

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

1 vote
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 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);
                }
            });
        });
    }
});
Hsu Yao Chang October 10, 2015

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 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.

Hsu Yao Chang May 22, 2016

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
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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
TAGS
AUG Leaders

Atlassian Community Events