I am trying to display a list of all non-archived spaces, and the space list macro doesnt seem to have this option.
how can I achieve this?
Hi @Ayelet Gazit Welcome to the Atlassian Community!
Currently the Spaces List Macro lists all spaces, even if they are archived. There is a suggestion raised with Atlassian to not list archived spaces using that macro, which you can track here -
Spaces List Macro should not list archived spaces
I would suggest you to vote for it and start watching it for updates.
Thanks, I voted. How else would you suggest me to display a list of active spaces?
I don't mind writing manually which spaces I want to display, but want to be able to display a list of multiple non archives spaces.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great. If you are familiar with REST API, @Pramodh M has already given a solution in his response (thank you Pramodh for that) which is an efficient way and will save your time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well, I am not really familiar with REST API. How do I use that inside the page? is there a macro for that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Install Git Bash, JQ tools in your local system
https://stedolan.github.io/jq/
and run the commands replacing all the parameters in API
You need to create a API token in here https://id.atlassian.com/manage-profile/security/api-tokens
Let me know if you have any doubts
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome to Confluence!!
Using API!!
Here's the API to list down the Spaces in your instance and the API details contains whether the space is active or archived
https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-wiki-rest-api-space-get
Thanks,
Pramodh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI
Find the example below
curl -s \
--request GET --url "https://your-site.atlassian.net/wiki/rest/api/space?limit=1000&status=archived" \
-H 'Content-Type: application/json' \
--user 'email-id:token' | jq --raw-output .results[].name
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI and to get the Active spaces, change the API as
curl -s \
--request GET --url "https://your-site.atlassian.net/wiki/rest/api/space?limit=1000&status=current" \
-H 'Content-Type: application/json' \
--user 'email-id:token' | jq --raw-output .results[].name
You need JQ to be installed on order to extract JSON data
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.