Need to fetch Space admin details of all the spaces in confluence

Jayesh Raghuvanshi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 1, 2022

Hi Team,

We use confluence data center LTS version 7.13.4 and have around 1800 client spaces to manage, we need to gather data for all the spaces like space name, space key and space admin details.

Kindly provide a way either by UI, API or SQL to fetch the above information.

 

Thanks

 

1 answer

0 votes
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 1, 2022

Hi @Jayesh Raghuvanshi  ,

You can use HTML amcro and JS like:

let spaces = []
async function getSpaces() {
let spResp = await fetch('/rest/api/space');
let spacesJson = await spResp.json();
spaces.push(...spacesJson.results )
let nextLink = spacesJson._links_next;
while(nextLink !== undefined) {
let tempResp = await fetch(nextLink);
let tempSpacesJson = await tempResp .json();
spaces.push(...tempResp.results )
let nextLink = tempSpacesJson._links_next;
}
}
getSpaces()
...

 With REST API it will be rather slow.

 

2) You can use JAVA SDK https://docs.atlassian.com/ConfluenceServer/javadoc/7.18.0/ and Groovy Runner  / ScrptRunner to get necessar info (it wll be much faster)

 

def spaceManager = ComponentAccessor.getCOmponent(SpaceManager.class)
def spaces = spaceManager.getAllSpaces;
spaces.each {
out << it .name
out << it.key#
...
}

3) You can create macro with JAVA SDK https://docs.atlassian.com/ConfluenceServer/javadoc/7.18.0/ 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events