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
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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());
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.