-
Suggestion
-
Resolution: Unresolved
-
None
Issue Summary
Currently, we have way to retrieve the direct children of a piece of content in the same order as it appears in the content tree, using the Get content descendants by type endpoint (with the depth=root parameter).
However, with this endpoint, we need to make separate requests for each content type, which makes it difficult to use pagination while keeping the correct order.
For example, to retrieve the first 50 children of the content with ID 123, we have to make the following five requests and merge/sort the results manually to get the correct order:
/wiki/rest/api/content/123/descendant/page?limit=50&depth=root /wiki/rest/api/content/123/descendant/whiteboard?limit=50&depth=root /wiki/rest/api/content/123/descendant/database?limit=50&depth=root /wiki/rest/api/content/123/descendant/embed?limit=50&depth=root /wiki/rest/api/content/123/descendant/folder?limit=50&depth=root
It would be helpful to have an endpoint that returns all direct children in the correct order with one request, regardless of their content type, for example, something like:
/wiki/api/v2/content/123/descendants?limit=50&depth=root
Then we would get the results similar to the below:
{ "results": [ { "id": "1", "type": "page" }, { "id": "2", "type": "whiteboard" }, ... ], "_links": { "next": "..." } }
The existing type-specific APIs could then be used to get the content details (title, URL, etc.).
Additionally, there’s no API that can retrieve the new content types at the root of a space (for example, if the space doesn’t have a home page). There’s only the Get pages in space endpoint, which does not retrieve the content on that case.
- We could also implement the ability to use an endpoint like the one I described above, but for the space root, e.g., /spaces/{id}/content?depth=[root|all], which would return the ID and type of each content.
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available