Using server Confluence 7.19.4 Is there a way to create reports using existing BLOGS

jovan savin June 23, 2023

I am using Confluence 7.19.4 (server)  we have daily Blog now for several years would like to create stats reports that would go through the Blog and list various tasks that were completed and list the stats how many entries per user.

Anyone has done something like this? Would appreciate help if you have accomplished something similar to what I need to do. 

Thank You  

1 answer

1 accepted

1 vote
Answer accepted
Andrii Maliuta
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.
June 28, 2023

Hello @jovan savin ,

For this custom addon or user macro can be used to create the report as you need with Atlassian Java SDK - https://developer.atlassian.com/server/. You can get blogs by CQL or per space and then get tasks for users by blogs authors names.

jovan savin June 28, 2023

Hi Andrii, would be great to get user macro just not sure how to go about creating one?

Just a simple report getting stats by users that entered the blog entry how many entries they had during the month year and what type of entries they had. 

Do you have any examples? 

Andrii Maliuta
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.
June 29, 2023

Hello @jovan savin ,

1) you can use REST API and JavaScript code on any Confluence page.

The JS code that can be embedded into HTML macro would be:

<div id="users-blogs"></div>

<script>

const usersDiv = document.querySelector('#users-blogs');

// add users here
const userNames = ["some1", "some2"]

async function getBlogs(userName) {
const resp = await fetch('https://someconfluence.com/rest/api/search?cql=type=blogpost%20and%20creator%20=${userName});
return await resp.json()['results'];
}

for (let user of userNames) {
const blogs = getBlogs(user);
for (let blog of blogs) {
const blogElement = document.createElement('div');
blogElement.innerHTML = '<div>${blog.body.view.value}</div>';
usersDiv.appendChild(blogElement);
}
}
</script>


2) Java / Groovy code in ScriptRunner:

}
 void getBLogs() throws EntityException {
ContentService contentService = ComponentLocator.getComponent(ContentService.class);
UserManager userManager1 = ComponentLocator.getComponent(com.atlassian.user.UserManager.class);

List<Content> allBlogs = new ArrayList<>();

userManager1.getUsers().forEach(user -> {
PageResponse<Content> blogs = contentService.find(new Expansion("body"))
.withType(ContentType.BLOG_POST)
.fetchMany(ContentType.BLOG_POST, new SimplePageRequest(0, 50));
allBlogs.addAll(blogs.getResults());
});
jovan savin June 30, 2023

Andrii, Is there a chance to meet online so that I can show you what I am working on and perhaps be able to help me figure this Blog reporting, or if there is training that I can take and learn how to do this. Your help will be greatly appreciated. Thank You

Like Andrii Maliuta likes this
Andrii Maliuta
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.
June 30, 2023

@jovan savin ,

Yes, we can try to connect :)

You can send the mail to quadr988@gmail.com or use https://calendly.com/andrii_maliuta/15min and we can try to arrange the meeting online from tomorrow - will try to help :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events