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 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
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.
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
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.
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.
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
well, I am not really familiar with REST API. How do I use that inside the page? is there a macro for that?
It looks like you're new here. Sign in or register to get started.