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
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
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...

388 views 21 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