Move from AttachmentManager / PageManager to AttachmentService / ContentService


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 = 

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.


@GustavS, did you ever figure out what the answer here was? I also have not found a way to get the content of a specific attachment version without using the deprecated method AttachmentManager.getAttachment(long id).

1 Like