Hi Community, I’m kindly asking you for advice on the issue that I’m currently facing.
In code, that was working recently we have:
Page page = pageManager.getPage(space.getKey(), title); String pageBody = page.getBodyAsString();
As you can see, we were able to obtain the page body as a string. This approach is currently still working. however, method getPage on PageManager is deprecated, so I have rewritten the code to this:
Optional<Content> pagex = contentService.find().withType(ContentType.PAGE).withSpace(space).withTitle(title).fetch(); Map<ContentRepresentation, ContentBody> bodyx = pagex.get().getBody(); //This however returns an empty Map.
In general, I have 2 questions:
- The Page returned thru the page manager is com.atlassian.confluence.pages.Page but Page returned with ContentService is Content. Is there any way how to convert content to that Page object? Similar problem I have with Space & SpaceService.
- How to get the page body described above? Content was returned correctly, page is found, so why content.getBody() is returning an empty map where pageManger.getPage().getBodyAsString() is returning expected string.
Thanks in the advance.