REST API V2: How to get all content in a space?

I need to get the content IDs of all contents in a Confluence Cloud space.

Using v1 REST API I could do that using the space/<SPACEKEY>/content endpoint, or one of the space/<SPACEKEY>/content/<TYPE> endpoints.

Those are deprecated and I must use v2, so the documentation says.

But how?

There are only v2 REST API endpoints for getting pages in a space](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-spaces-id-pages-get), and blogposts in a space.

But what about databases, whiteboards, folders, you name it? How to get all of those in a space?

(And before you say CQL or search-based approaches: I cannot use them, because restricted contents won’t be included in the result, even if the user asking has permissions to see them.)

How to get all space content in Confluence Cloud with non-deprecated REST endpoints?

As far as I know, there is no API that returns all content (including the new content types) in a space. The deprecated Get content for space endpoint also returns only pages and blog posts.

1 Like

Hi @heinrich-wikitraccs
I haven’t come across an API that retrieves all space content, such as whiteboards, databases, folders, etc., in one go. It seems like the REST API might handle these objects separately from the search for pages or blog posts. However, we’ll have to wait and see what direction the Atlassian team takes.

For reference, here are the links to the relevant API documentation:

1 Like

Thanks to the answer of @klaussner over here, I might have found the answer to get all content in a space.

The v1 descendant endpoint (not deprecated!) can also handle the new content types (although the docs don’t list them…).

So starting with the root content(s) of a space, we can call

/rest/api/content/<ROOTCONTENTID>/descendant/whiteboard
/rest/api/content/<ROOTCONTENTID>/descendant/database
/rest/api/content/<ROOTCONTENTID>/descendant/folder

This collects everything for the space.

(Not sure yet, though, how to get all root contents for the space if those are non-page.)

Edit: Even better, we can use rest/api/content/<ROOTCONTENTID>/descendant?expand=whiteboard,database,folder,embed,page,blogpost to get all those. This is documented.

3 Likes