Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confluence - how to obtain a list of spaces created

Hi,

I have a request for a report/list of spaces created w/in Confluence that includes:

name of space

created date

Space owner

URL

Is there a way to do this w/in Confluence?

Thanks in advance.

2 answers

Here are a couple of options:

  1. If you have SQL for Confluence, then you can use the sql-query macro against the Confluence database with: select * from spaces
  2. Confluence Command Line Interface (CLI) has the getSpaceList action which will provide a list with some of these attributes

I wrote this script to pull the data, you can copy and paste it into the browser javascript console after you have logged into Confluence and it will print out the data you are looking for.

jQuery.ajax({
  contentType: 'application/json',
  type: 'POST',
  url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getSpaces',
  success: function( spaceSummaries ) {
    jQuery(spaceSummaries).each(function() {
      if (this.type === 'global') {
        var spaceKey = this.key;
        jQuery.ajax({
          url: contextPath + "/rest/prototype/1/space/" + spaceKey,
          dataType: "json",
          success: function(spaceData) {
            console.log("Space - " + spaceData.name);
            console.log("Key - " + spaceData.key);
            console.log("Created - " + spaceData.createdDate.friendly);
            console.log("Last Modified - " + spaceData.lastModifiedDate.friendly);
            if (spaceData.hasOwnProperty("home")) {
              console.log("Creator - " + spaceData.home.creator.name);
              console.log("Last Modifier - " + spaceData.home.lastModifier.name);
            }
            console.log("URL - " + spaceData.link[1].href);
            console.log("----");
          }
        });
      }
    });
  }
});

EDIT: Here is a version that waits for the previous connection to finish before requesting a new one (it doesn't put so much pressure on your Confluence instance).

var parseSpaces = function(spaceSummaries) {
  var spaceSummary = spaceSummaries.shift();
  if (spaceSummary.type === 'global') {
    var spaceKey = spaceSummary.key;
    jQuery.ajax({
      url: contextPath + "/rest/prototype/1/space/" + spaceKey,
      dataType: "json",
      success: function(spaceData) {
        console.log("Space - " + spaceData.name);
        console.log("Key - " + spaceData.key);
        console.log("Created - " + spaceData.createdDate.friendly);
        console.log("Last Modified - " + spaceData.lastModifiedDate.friendly);
        if (spaceData.hasOwnProperty("home")) {
          console.log("Creator - " + spaceData.home.creator.name);
          console.log("Last Modifier - " + spaceData.home.lastModifier.name);
        }
        console.log("URL - " + spaceData.link[1].href);
        console.log("----");
        if ( spaceSummaries.length > 0 ) {
          parseSpaces(spaceSummaries);
        }
      }
    });
  }
  if ( spaceSummaries.length > 0 ) {
    parseSpaces(spaceSummaries);
  }
}
jQuery.ajax({
  contentType: 'application/json',
  type: 'POST',
  url: contextPath + '/rpc/json-rpc/confluenceservice-v2/getSpaces',
  success: function( spaceSummaries ) {
    console.log("Starting...");
    parseSpaces(spaceSummaries);
  }
});

Hi Stephen, I have tried this, but it's only showing a small % of all spaces. I removed (this.type === 'global') condition and yet it shows 15-20 out of 200 spaces.

Hi Adolfo, Are you using Firefox? I tried it with Firefox and it seems like it runs OK, but it also cuts off some of the results. It might be better in IE or Chrome. I also put in a new version, that might work better.

Yes, it's FF. That new version works OK. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

132 views 9 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you