Script which result all the space name in a Confluence instance

Hi All,

I have a connected Jira and Confluence instance and I have a custom field which contains all the existing space names of the Confluence. This custom field serves the space admins when they request to add users to their own space. In this case they have to select the appropriate space name from this list.

Thw problem is that the space admins use to change the space names very often and it's very cumbersome to update manually the options of this custom field every time.

For first: is there a script which results all the existing space names?

And then I would set this script to a custom field (if I can..)

Thanks in advance for the help!


1 answer

1 accepted

2 votes
Accepted answer
David Simpson Community Champion Jun 25, 2012

Calling on a Confluence server would produce some JSON with a list of spaces:

{"expand":"space","space":[{"id":"65537","key":"ds","name":"Demonstration Space","title":"Demonstration Space","link":[{"href":"http://localhost:1990/confluence/rest/prototype/1/space/ds","rel":"self"},{"href":"http://localhost:1990/confluence/display/ds","type":"text/html","rel":"alternate"}],"description":"","lastModifiedDate":{"friendly":"Sep 16, 2008","date":"2008-09-16T13:42:44+0100"},"createdDate":{"friendly":"May 15, 2008","date":"2008-05-15T05:15:14+0100"},"wikiLink":"[ds:]","type":"space"}]}

You could then create the select field from the results

Hi David,

I never seen like this? What's that? The link is unavailable.


David Simpson Community Champion Jun 25, 2012

Don't click on the link -- it's only an example! Try this instead: It gives XML rather than JSON, but the logic still holds up.

You'll need to login to your Confluence server and replace the hostname with yours.

Admittedly, this doesn't give you the complete answer, but hopefully nudges you in the right direction to get the information you need :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

158 views 3 5
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