I need to get a list of all spaces and included if archived (or not).
I have successfully retrieved a list of all of my spaces using
url = ... rest/api/space
url = ... rest/spacedirectory/1/search?type=global
Both cases do not return the status value if archived or not. I've tried adding 'status' to expand but that doesn't help.
So, how can I tell if the space is archived or not?
Well, you were close. I really wanted to retrieve all Spaces then see each space's status value. However, reading your link, all I have to do is put status in the expand to see the status value.
However, my focus right now is on Confluence Server and the link you sent does not work for Server. The confluence server documentation is not as robust as cloud and reading it does not give me an obvious way to get the 'status' field back with each space.
This is the page I'm looking at for the server REST API - Space
The query for Confluence Server and Cloud look to be identical to me. Both have an identical endpoint "
/rest/api/space" and both support the use of the status= parameter to filter the results.
When you submit a request to
http://your_confluence_url/confluence/rest/api/space?status=archived , as per the Confluence Server documentation, does it or does it not return list of archived spaces?
According to the documentation, that endpoint can return the value of the status of the content of a space, but you have to ask for it specifically using the expand= parameter. On the documentation page, click the button 'schema' to see all the properties that can be returned. A few lines down down you'll see:
"title": "Content Status",
If you provide
tp://your_confluence_url/confluence/rest/api/space?expand then you should be given a list of what properties can be expanded.
So, I'm guessing the expanded request would be
http://your_confluence_url/confluence/rest/api/space?expand=definitions or http://your_confluence_url/confluence/rest/api/space?expand=definitions.content
Sorry, I don't have access to a Confluence Server ATM to test this, so just report your result.
OK, my Server query does work correctly when I use
Where the Cloud and Server separate is on the results. I've tried many expand combinations but I can't get anything from the content structure.
As a side note, for the server query, _expandable returns
I can expand on only those values (like homepage) and get the expected results.
I've tried expanding with: 'defintions', 'defintions.content', 'content', 'content.status', etc. .. all have no effect.
The good news .. I can just search the specific status value and combine as needed. But this is just a haunting curiosity why I can't retrieve back any of values under content.
OK, good to hear you have at least one method of getting the archived vs non-archived spaces.
As for the inability to expand the other properties or the REST API even reporting they're there, I'd guess you're using an older version of Confluence Server that didn't support those methods / properties listed on the linked documentation page.
PS. If this turns out to be the case, remember to mark the answer as accepted.
I just tested against Confluence Cloud and can confirm the status of the space is returned by the endpoint /wiki/rest/api/space
Here's an example of a response:
name "ActiveObjects Plugin"
Sorry, can't provide any further advice re Confluence Server, as I don't have access to one ATM.
I posted an issue to the Atlassian help center and they clarified the situation. You are absolutely correct dealing with the cloud. The cloud doc on Get Spaces is accurate. And in both cases (cloud & server), you can only derive the status value by issuing a query on status.
Atlassian admitted that the schema portrayed in api/space in the Server doc is not correct in that shows the entire schema .. you have to drill down in the middle to find the section that applies to space. It appears the expand options for cloud and server are very similar in that to get information on labels you need to expand 'metadata.labels' and to get the description expand 'description.plain'.
Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...
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