At this time, it is impossible (or extremely, extremely badly documented) for apps to retrieve Pages, Content, Spaces by ID or perform a CQL search in Confluence 8.0 EAP with the official APIs.
- PageManager.getById(), ContentEntityManager.getById() have been deprecated since Confluence 7.5,
- PageManager.getPage(String spaceKey, String pageTitle) has been deprecated since Confluence 7.3,
- Both redirect us to com.atlassian.confluence.api.service.content.ContentService.find(Expansion…) which is unusable/not documented (There is no valid Expansion argument which searches for content by ID or name, I’ve tried to guess which subclass of Expansion can do it, but there are a lot of classes without Javadocs),
- The example provided in the JavaDoc of ContentService (
contentService.find().withSpace("DEV").withType(ContentType.BLOG_POST).fetchMany(new SimplePageRequest(0,50)
) is incorrect since it doesn’t compile - It expects a Space object as a parameter, not a space key, so should I always callspaceService.find().withKeys("DEV","PROD").fetchMany(new SimplePageRequest(0, 10)
first, as shown in the Javadoc of SpaceService? It seems unnecessarily convoluted and basically inefficient, is the code of Confluence itself doing that? (There is no instance where the source of Confluence does that). - Classes such as SiteSearchPermissionsSearchFilter have been removed, so we can’t apply user permissions when searching (which is a security breach awaiting to happen),
- Last but not least, they change method signatures without notice!
** In 7.19: ContentSearch(SearchQuery query, SearchSort sort, SearchFilter searchFilter, int startOffset, int limit)
** In 7.20: ContentSearch(@NonNull SearchQuery query, SearchSort sort, int startOffset, int limit),
** The ‘searchFilter’ argument was simply removed, no deprecation, it’s a public API class, so we can’t write code for 7.20 which works in 7.19, and we can’t write code for 7.19 that works in 7.20.
It would be very nice, or very helpful for the continued compatibility of apps, if an Atlassian engineer could write us examples for the following usecases, which are essential for plugins to integrate with Confluence:
- How to perform a CQL search,
- How to simply get a page by ID, a page version by ID and a space by key, and hopefully a page by title,
- How to modify the body of a page and save it as a new version (since getById() is deprecated, I suspect it is impossible),
- All of this using using genuine ContentEntityObject.java (Page, Blog, Comment, Space.java) and not a shell object like those returned by the search. If necessary, show us how to return shell objects into complete objects.
Thank you very much,
Adrien Ragot