Hi.
There is an apparent move from AttachmentManager / PageManager (which are becoming internal) to AttachmentService / ContentService. Unfortunately there’s still a lack of any documentation on the matter (that I’m aware of). Ran into several issues while migrating to the new approach:
- How to retrieve the raw body of an attachment using AttachmentService, to replace AttachmentManager.getAttachmentData(attachment)?
Tried retrieve it using:
Content attachment =
attachmentService.find(ExpansionsParser.parse("body"))
.withId(attachmentId)
.fetchOrNull();
attachment.getBody() always returns an empty Map.
-
How to return a specific version of an attachment?
I assume ContentVersionService has something to do with it.
Otherwise filtering versions from AttachmentService, by first fetching all of them, looks like a bad approach. -
How to replicate Attachment.getDownloadPathWithoutVersion() using Content (com.atlassian.confluence.api.model.content.Content)?
-
Can attachments, pages, blog post and comments be created / updated / deleted using ContentService / AttachmentService, the same way it was done using PageManager / AttachmentManager?
Any help with the questions above would be greatly appreciated.