Hi,
We’re currently replacing RPC calls in our tests with REST calls to ensure compatibility with Confluence 10.
I’m trying to create a simple space with the key TEST, containing two pages:
- one titled parent, which is a child of the space’s home page, and
- one titled child, which should be a child of the parent page.
The desired hierarchy looks like this:
home page
└── parent
└── child
I’m using confluence-test-utils, which leverages Confluence’s official REST API. The code for creating a page is straightforward:
Content newPage =
Content.builder(ContentType.PAGE)
.title(title)
.space(spaceKey)
.body(content, ContentRepresentation.STORAGE)
.parent(Content.builder(ContentType.PAGE, parentId).build())
.build();
restSession.contentService().create(newPage);
The space and its pages are created correctly, and the hierarchy is shown as expected in the UI. However, when I fetch the ancestors of the child page, I receive two entries: the home page and the parent page — but in that order. So child.getParentId() returns the ID of the home page, because it takes the first ancestor in the list.
In my understanding, this is incorrect. The direct parent of child should be the parent page, not the home page.
This functionality is important for us, as we rely on accurate parent-child relationships in our test logic. Is this a bug in the REST API? @Kusal Do you know who might be the right person to look into this?
Any help is much appreciated.
Thanks,
Daria