how to get each users' number of published articles

My confluence vision is 3.2.1
Now I want to get each users' number of published articles and the record of users modifying the articles

If confluence provide some API ? OR query from the table of database

1 answer

1 accepted

Hey Jone,

if you want to get the information from the database you can take a look at the Confluence DB Modell:

 

image2016-12-15 9:29:25.png

The Content-Table provides information about the creator and last modifier.

 

If you want to access these information using the Java API, you can use the SpaceManager and PageManager to get all Page-Objects and then use the methods of the ConfluenceEntityObject-class, which provides methods to get the creator and last modifier.

 

If you want to create a custom macro to display these information you can also access these entities like this:

## Get PageManager object instance
#set($containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager=$getInstanceMethod.invoke(null,null))
#set($containerContext=$containerManager.containerContext)
#set($spaceManager=$containerContext.getComponent('spaceManager'))
#set($pageManager=$containerContext.getComponent('pageManager'))
  
#set($output = "<h1>Pages</h1>")
 
## get spaces
#set($spaces = $spaceManager.getAllSpaces())

#foreach($space in $spaces)
	#set($pages= $pageManager.getPages($space, true))
	
	#foreach($page in $pages)
		#set($output = $output + "<ul>$page.getTitle() (creator: $page.getCreator(), last modifier: $page.getLastModifier()</ul>")
	#end
#end

$output

(I didn't test it, just wrote it here so it probably needs some changes wink )

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,783 views 25 10
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