How to get first-depth folders in a space?

I couldn’t find API for getting folder in v2.
So I tried “/wiki/rest/api/content” v1 API but it doesn’t return folder.

Below v1 APIs return correctly folders under a page, but I could not figure out how to get folders on first-depth in a space.
/wiki/rest/api/content/{id}/child
/wiki/rest/api/content/{id}/descendant/
/wiki/rest/api/content/{id}/descendant/{type}

Hi @mkctkr,
It seems like the v2 api are not yet fully functional (In V2 Get children of all types is not available

We’ve had to rely on the search (v1) api for this.

You can use expands to retrieve child folders / pages / other:

expand=content.children.folder, expand=content.children.page, expand=content.children.whiteboard, etc…
Or combine the expands

Thanks for the answer @Corentin !
I have few more questions.

  • search v1 api with cql(cql=type=folder) returns all folders. it is hard to know the hierarchy of folders. is there good approach to get only top level folder?
  • in search v1 api document, there is no explanation about expand. where can I find details of expand?

If you’re looking for first-level folders in the space, I think you could have the pageId of the homepage, or the space id in your cql. Something like cql=ancestor=<homepageId>, or cql=parent=<homepageId>

I don’t really know where expands are documented. You can think of expands as an Atlassian made graphql replacement. I usually try to send requests and look at the _expandable field in the response for discovery.

I didn’t know homepage is the first-level of content structure.
Thanks @Corentin

Glad I could help :wink: